GPS
| Documentation | /NGOS | /Signals | /Shells | /Cmds | /Ctrl | /HALs | /Conf | /Params | /Behaviors | /Receiver | /GPS | Next Chapter |
The NG GPS Support
Introduction
The NG supports all sorts of different GPS receivers. Any 3.3V powered GPS receiver supporting the NMEA protocoll, a serial port and 4-5Hz or more update rate should do.
Proven GPS Modules
Venus GPS with SMA Connector
The Sparkfun Venus GPS is used by several NG developers.
The module can be configured to an amazingly powerful 20Hz update rate, with 14 channel tracking! 60-90mA operating current, and high sensitivity, this receiver seriously opens new doors for tracking. Module outputs the standard NMEA-0183 or SkyTraq Binary sentences at a default rate of 9600bps (adjustable to 115200bps).
Venus GPS Logger with SMA Connector
The Sparkfun Venus GPS Logger is similar to the above Venus GPS but contains als a 2MB storage for GPS Logging capabilities. It’s also used by several NG developers.
The module can be configured to an amazingly powerful 20Hz update rate, with 14 channel tracking! 29mA operating current, and high sensitivity, this receiver seriously opens new doors for tracking. Module outputs the standard NMEA-0183 or SkyTraq Binary sentences at a default rate of 9600bps (adjustable to 115200bps).
Cabeling
How to connect your GPS
The GPS gets connected to the serial port of the SB-Controller using the Molex connector on the NG sensor board.
Configuring your GPS for the NG
Configuring a Sparkfun Venus GPS Logger Module
Start the GPS Viewer Software under Windows and connect to the COM port where you Venus GPS is attached.
Go to the Binary-Menu of the GPS Viewer Software. There configure the following:
- Baudrate: 115200
- AGPS: enabled
- WAAS: enabled
- NMEA Messages needed: GGA, GSA, RMC
- Update rate: 10Hz
{i} Make sure that you kicl on the AGPS Download menu point in the AGPS menu which will download the current ephemeris data using FTP and then flash it to your Venus GPS.
Configuring GPS support on the NG
How to configure the baud rate
You can configure the baud rate on the SB-Controller using it’s shell.
{i} Note: The SB-Controller is a 3.3V device!
Checking and setting the SB-Controller terminal baud rate:
UAVP-NG, SB-Controller, Version 0.60, Revision r4827
Use 'help' to show a list of commands
# set HW.uart.baud 115200
Setting integer 'HW.uart.baud' to '115200'
# show globals
Current global configuration:
HW.uart.baud 115200 UART baudrate
...How to configure the global settings
Make sure you activate the hardware data aquisition drivers in the global parameters. To do GPS navigation you will need to activate NGPP, GPS and the Compass as it has been done it the following settings:
# set HW.use.ngpp yes
Setting boolean 'HW.use.ngpp' to '1'
# set HW.use.gps yes
Setting boolean 'HW.use.gps' to '1'
# set HW.use.compass yes
Setting boolean 'HW.use.compass' to '1'
# show globals
Current global configuration:
Name DCM-TR3530 Configuration name
...
HW.use.sound inverted HW do use sound device
HW.use.acc yes HW do use accelerometer
HW.use.baro yes HW do use barometer
HW.use.ngpp yes HW do use NG peripherial protocol (NGPP)
HW.use.gps yes HW do use Global Positioning System (needs NGPP)
HW.use.compass yes HW do use compass (needs NGPP)
...The above will make sure, your NG will fetch the necessary data from the attached peripherial CPUs and provide them to the NG controllers.
How to configure the controller settings
To get a controller to use the compass and GPS data in it’s closed-loop, you also have to activate their usage in the controller dependent parameters:
# set CTRL.use.compass yes
Setting boolean 'CTRL.use.compass' to '1'
# set CTRL.use.gps yes
Setting boolean 'CTRL.use.gps' to '1'
# show conf
Current system configuration:
Controller amir-ng Closed-loop controller
...
CTRL.use.acc yes CTRL do use accelerometer
CTRL.use.baro yes CTRL do use baro
CTRL.use.compass yes CTRL do use compass (needs NGPP)
CTRL.use.gps yes CTRL do use GPS (needs NGPP)
...How to configure the Venus GPS on hardware 0.24
On the hardware 0.24. the venus GPS is multiplexed with the UART1 interface. To detect the GPS, type:
# venus init uart1
Probing on 1200.
Probing on 2400.
Probing on 4800.
Probing on 9600.
Found GPS on 9600 Baud
Configuring GPS to: 115200 [baud]
RAW DATA: a0 a1 00 04 05 00 05 00 00 0d 0a
Configuring uart1 to 115200 [baud]
Configuring position update rate to: 10 [Hz]
RAW DATA: a0 a1 00 03 0e 0a 00 04 0d 0a
Configuring WAAS: Enabled
RAW DATA: a0 a1 00 03 37 01 00 36 0d 0a
Configuring navigation mode to: Car
RAW DATA: a0 a1 00 03 3c 00 00 3c 0d 0a
Configure GPS NMEA messages GGA GSA RMC
RAW DATA: a0 a1 00 09 08 01 01 00 00 01 00 00 00 09 0d 0a The first time you do venus init, the GPS should be found at the default baudrate 9600. The baudrate will be changed to 115200. Save the configuration to the venus flash:
# venus init uart1 storeHow to check the GPS gets recognized
When the GPS gets recognized by your NG it will create a device table entry for it. You can check if the GPS got recognized like this:
# show devices
Detected devices:
Addr Bus Description
0x16 I2C0 Atmel 644P RC/Comm Controller
0x18 I2C0 Atmel 328P SB Controller
0x02 ADC12 ADXR/MLX MEMS Gyroscope 12bit (nick)
0x01 ADC12 ADXR/MLX MEMS Gyroscope 12bit (roll)
0x00 ADC12 ADXR/MLX MEMS Gyroscope 12bit (yaw)
0x00 SPI0 LIS3LV02DQ 3-Axis Accelerometer
0x02 SPI0 ADS1255 24bit Analog Digital Converter
0x03 SPI0 AD7924 12bit Analog Digital Converter
0x00 SBCTRL MicroMag 3 Magnetic Compass (calibrated)
0x02 SBCTRL NMEA Global Positioning SystemHow to configure behaviors rules GPS
There are several behavior actions related to GPS navigation:
- nav.position.hold(on/off)
- nav.store.and.position.hold(on/off)
- nav.coming.home(on/off)
- nav.store.target()
- nav.set.target(lat,lon)
Elementary behavior configuration for position hold (PH) consists of two simple behavior rules to activate and deactivate position hold when (for example) pot2 gets triggered:
# list behaviors
List of currently defined behaviors:
No Condition Action
...
14 when.rc.pot.binary(2,0) => nav.position.hold(off)
15 when.rc.pot.binary(2,1) => nav.position.hold(on)
...Checking GPS data
How to check your NG’s current position
You can check your NG’s current position with the print position command:
# print position
GPS Status: valid
Satellites: 10
Time: 18:45:00.600
Date: 17-09-2010
Latitude: 47.3614387 degree
Longitude: 8.600522 degree
Altitude: 620.9000244 meters
Speed: 10 cm/sHow to check your NG’s current date and time
You can check your NG’s date and time, received by GPS with the print time and print date commands:
# print time
18:45:54.200
# print date
17-09-2010Checking navigation
How to check the current navigation calculation
You can check the current GPS navigation calculation with the command show nav in a GPS-enabled controller. For this to work, your NG has to be flying (so you need to fly or start a simulation) and you need to activate position hold (PH) using a behavior rule.
# show nav
Navigation:
Flight state: GPS position hold
Kalman Position lon: -4.09 [m] (fused guess)
Kalman Position lat: -2.43 [m] (fused guess)
Current target position lon: 0.00 [m]
Current target position lat: 0.00 [m]
Current target curse lon: 4.09 [m]
Current target curse lat: 2.43 [m]
Current copter heading Y_mag: 129.9 [deg] (compass)
Current copter heading Y_n: 130.0 [deg] (compass)
Navigation target deviation angle: 19.6 [deg]
Navigation target distance: 4.8 [m]
Navigation nick stick override navN: 224 [angle] 2.5 [deg]
Navigation roll stick override navR: -82 [angle] -0.9 [deg]Using GPS in-flight
/!\ still under development: PH works, but needs to be optimized, CH and WN simulations work, but are untested in practice; so please be carefully.
For GPS support we have a set of parameters influencing the behaviour of the controller:
| parameter | value | description |
| POS.Kalman.Q | 0.05000000 | Pos Kalman process var (Acc for GPS) |
| POS.Kalman.R.pos | 0.00400000 | Pos Kalman position system var (GPS) |
| POS.Kalman.R.vel | 0.05000000 | Pos Kalman velocity system var (GPS) |
| POS.PT1.comp.k1 | 800 | Pos feedback PT1 compensation K1 (GPS) |
| POS.PT1.comp.t1 | 170 | Pos feedback PT1 compensation T1 (GPS) |
| NAV.brake.P | 700 | Nav brake proportional factor |
| NAV.brake.D | 10 | Nav brake differential factor |
| NAV.brake.I | 0 | Nav brake integral factor |
| NAV.brake.radius | 2 | Nav brake circle radius [m] |
| NAV.slowdown.radius | 20 | Nav slowdown circle radius [m] |
| NAV.slowdown.maxspeed | 30 | Nav slowdown max speed [cm/s] |
| NAV.travel.maxspeed | 60 | Nav travel max speed [cm/s] |
| NAV.angle.max | 9 | Nav maximum angle |
| NAV.angle.attack | 9 | Nav angle attack (exponent*10) |
| NAV.min.satellites | 7 | Nav minimal number of satellites |
How to use GPS Position Hold (PH)
To use position hold (PH) in-flight you need to configure behavior rules to activate it.
When you switch on PH using the behavior action nav.position.hold(on) your NG will return to its previously set target position. This target has to be set by using the nav.store.target(). (The action nav.store.and.position.hold(on) will set the target position as well). If no target has been set the action nav.position.hold(on) won’t work.
Example Behavior Configuration:
behavior add when.rc.pot.binary(2,0) nav.position.hold(off)
behavior add when.rc.pot.binary(2,1) nav.store.and.position.hold(on)When you switch on PH using the behavior action nav.store.and.position.hold(on) and the number of received satellites >= NAV.min.satellites you will hear two short beeps (otherwise one long beep). Then your NG stores it’s current position as target position, starts doing navigational calculations and begins to influence your sticks.
The command show nav will display this calculation and it’s results.
How to use GPS Coming Home (CH)
Your NG stores it’s home position when it starts. You can use coming home (CH) to make your NG fly back to it’s start position.
When you switch on CM using the behavior action nav.coming.home(on) your NG will set the home position as target position, will start doing navigational calculations and it will begin to influence your sticks. The command show nav will display this calculation and it’s results.
How to use GPS Waypoint Navigation (WN)
/!\ TODO

