Merge pull request #256 from iNavFlight/theArchLadder-landing-detector-avg-thr
[betaflight.git] / docs / Gps.md
blob3878106268b48feddc2f3e7d408fee3f3a24dc43
1 # GPS
3 GPS features in INAV are experimental.  Please share your findings with the developers.
5 GPS works best if the GPS receiver is mounted above and away from other sources of interference.
7 The compass/mag sensor should be well away from sources of magnetic interference, e.g. keep it away from power wires, motors, ESCs.
9 Two GPS protocols are supported. NMEA text and UBLOX binary.
11 ## Configuration
13 Enable the GPS from the CLI as follows:
15 1. configure a serial port to use for GPS.
16 1. set your GPS baud rate
17 1. enable the `feature GPS`
18 1. set the `gps_provider`
19 1. connect your GPS to the serial port configured for GPS.
20 1. save and reboot.
22 Note:  GPS packet loss has been observed at 115200.  Try using 38400 is enough in most of the cases.
24 For the connections step check the Board documentation for pins and port numbers.
26 ### GPS Provider
28 Set the `gps_provider` appropriately.
30 | Value | Meaning  |
31 | ----- | -------- |
32 | 0     | NMEA     |
33 | 1     | UBLOX    |
35 ### GPS Auto configuration
37 When using UBLOX it is a good idea to use GPS auto configuration so your FC gets the GPS messages it needs.
39 Enable GPS auto configuration as follows `set gps_auto_config=1`.
41 If you are not using GPS auto configuration then ensure your GPS receiver sends out the correct messages at the right frequency.  See below for manual UBlox settings.
43 ### SBAS
45 When using a UBLOX GPS the SBAS mode can be configured using `gps_sbas_mode`.
47 The default is AUTO.
49 | Value | Meaning  | Region        |
50 | ----- | -------- | ------------- |
51 | 0     | AUTO     | Global        |
52 | 1     | EGNOS    | Europe        |
53 | 2     | WAAS     | North America |
54 | 3     | MSAS     | Asia          |
55 | 4     | GAGAN    | India         |
57 If you use a regional specific setting you may achieve a faster GPS lock than using AUTO.
59 This setting only works when `gps_auto_config=1`
61 ## GPS Receiver Configuration
63 UBlox GPS units can either be configured using the FC or manually.
65 ### UBlox GPS manual configuration
67 Use UBox U-Center and connect your GPS to your computer.  The CLI `gpspassthrough` command may be of use if you do not have a spare USART to USB adapter.
69 Note that many boards will not provide +5V from USB to the GPS module, such as the SPRacingF3; if you are using `gpspassthrough` you may need to connect a BEC to the controller if your board permits it, or use a standalone UART adapter. Check your board documentation to see if your GPS port is powered from USB.
71 Display the Packet Console (so you can see what messages your receiver is sending to your computer).
73 Display the Configation View.
75 Navigate to CFG (Configuration)
77 Select `Revert to default configuration`.
78 Click `Send`.
80 At this point you might need to disconnect and reconnect at the default baudrate - probably 9600 baud.
82 Navigate to PRT (Ports)
84 Set `Target` to `1 - Uart 1`
85 Set `Protocol In` to `0+1+2`
86 Set `Protocol Out` to `0+1`
87 Set `Buadrate` to `57600` `115200`
88 Press `Send`
90 This will immediatly "break" communication to the GPS. Since you haven't saved the new baudrate setting to the non-volatile memory you need to change the baudrate you communicate to the GPS without resetting the GPS. So `Disconnect`, Change baud rate to match, then `Connect`.
92 Click on `PRT` in the Configuration view again and inspect the packet console to make sure messages are being sent and acknowledged.
94 Next, to ensure the FC doesn't waste time processing unneeded messages, click on `MSG` and enable the following on UART1 alone with a rate of 1. When changing message target and rates remember to click `Send` after changing each message.:
96     NAV-POSLLH
97     NAV-DOP
98     NAV-SOL
99     NAV-VELNED
100     NAV-TIMEUTC
102 Enable the following on UART1 with a rate of 5, to reduce bandwidth and load on the FC.
104     NAV-SVINFO
106 All other message types should be disabled.
108 Next change the global update rate, click `Rate (Rates)` in the Configuration view.
110 Set `Measurement period` to `100` ms.
111 Set `Navigation rate` to `1`.
112 Click `Send`.
114 This will cause the GPS receive to send the require messages out 10 times a second.  If your GPS receiver cannot be set to use `100`ms try `200`ms (5hz) - this is less precise.
116 Next change the mode, click `NAV5 (Navigation 5)` in the Configuration View.
118 Set to `Dynamic Model` to `Airborne<1G` and click `Send`.
120 Next change the SBAS settings.  Click `SBAS (SBAS Settings)` in the Configuration View.
122 Set `Subsystem` to `Enabled`.
123 Set `PRN Codes` to `Auto-Scan`.
124 Click `Send`.
126 Finally, we need to save the configuration.
128 Click `CFG (Configuration` in the Configuration View.
130 Select `Save current configuration` and click `Send`.
132 ### UBlox Navigation model
134 If GPS auto configuration is used INAV will use `Airborne<1G` when `gps_nav_model=LOW_G` and `Airborne<4G` when `gps_nav_model=HIGH_G`.
136 From the UBlox documentation:
138 * Pedestrian - Applications with low acceleration and speed, e.g. how a pedestrian would move. Low acceleration assumed. MAX Altitude [m]: 9000, MAX Velocity [m/s]: 30, MAX Vertical, Velocity [m/s]: 20, Sanity check type: Altitude and Velocity, Max Position Deviation: Small.
139 * Portable - Applications with low acceleration, e.g. portable devices. Suitable for most situations. MAX Altitude [m]: 12000, MAX Velocity [m/s]: 310, MAX Vertical Velocity [m/s]: 50, Sanity check type: Altitude and Velocity, Max Position Deviation: Medium.
140 * Airborne < 1G - Used for applications with a higher dynamic range and vertical acceleration than a passenger car. No 2D position fixes supported. MAX Altitude [m]: 50000, MAX Velocity [m/s]: 100, MAX Vertical Velocity [m/s]: 100, Sanity check type: Altitude, Max Position Deviation: Large
142 ## Hardware
144 There are many GPS receivers available on the market.
145 Below are some examples of user-tested hardware.
147 ### Ublox
149 ###U-Blox
151 #### NEO-M8
152 Module | Comments
153 -------|--------
154 U-blox Neo-M8N w/Compass |
155 Reyax RY825AI | NEO-M8N, 18Hz UART USB interface GPS Glonass BeiDou QZSS antenna module flash. [eBay](http://www.ebay.com/itm/RY825AI-18Hz-UART-USB-interface-GPS-Glonass-BeiDou-QZSS-antenna-module-flash/181566850426)
157 #### NEO-7
158 Module | Comments
159 -------|--------
160 U-blox Neo-7M w/Compass | [HobbyKing](http://www.hobbyking.com/hobbyking/store/__55558__Ublox_Neo_7M_GPS_with_Compass_and_Pedestal_Mount.html)
162 #### NEO-6
163 Module | Comments
164 -------|--------
165 Ublox NEO-6M GPS with Compass | [eBay](http://www.ebay.com/itm/111585855757)
168 ### Serial NMEA
170 #### MediaTek
171 Module | Comments
172 -------|--------
173 MTK 3329 | Tested on hardware serial at 115200 baud (default) and on softserial at 19200 baud. The baudrate and refresh rate can be adjusted using the MiniGPS software (recommended if you lower the baudrate). The software will estimate the percentage of UART bandwidth used for your chosen baudrate and update rate.