1 # GPS Fix estimation (dead reconing, RTH without GPS) for fixed wing
5 [![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/wzvgRpXCS4U/0.jpg)](https://www.youtube.com/watch?v=wzvgRpXCS4U)
7 There is possibility to allow plane to estimate it's position when GPS fix is lost.
8 The main purpose is RTH without GPS.
9 It works for fixed wing only.
11 Plane should have the following sensors:
12 - acceleromenter, gyroscope
15 - magnethometer (optional, highly recommended)
18 By befault, all navigation modes are disabled when GPS fix is lost. If RC signal is lost also, plane will not be able to enable RTH. Plane will switch to LANDING instead. When flying above unreachable spaces, plane will be lost.
20 GPS fix estimation allows to recover plane using magnetometer and baromener only.
22 GPS Fix is also estimated on GPS Sensor timeouts (hardware failures).
24 Note, that GPS fix estimation is not a solution for navigation without GPS. Without GPS fix, position error accumulates quickly. But it is acceptable for RTH. This is not a solution for flying under spoofing also. GPS is the most trusted sensor in Inav. It's output is not validated.
28 In normal situation, plane is receiving it's position from GPS sensor. This way it is able to hold course, RTH or navigate by waypoints.
30 Without GPS fix, plane has nose heading from magnetometer and height from barometer only.
32 To navigate without GPS fix, we make the following assumptions:
33 - plane is flying in the direction where nose is pointing
34 - (if pitot tube is not installed) plane is flying with constant airspeed, specified in settings
36 It is possible to roughly estimate position using theese assumptions. To increase accuracy, plane will use information about wind direction and speed, estimated before GPS fix was lost. To increase groundspeed estimation accuracy, plane will use pitot tube data(if available).
38 From estimated heading direction and speed, plane is able to **roughly** estimate it's position.
40 It is assumed, that plane will fly in roughly estimated direction to home position untill either GPS fix or RC signal is recovered.
42 *Plane has to acquire GPS fix and store home position before takeoff. Estimation completely without GPS fix will not work*.
44 # Estimation without magnethometer
46 Without magnethometer, navigation accuracy is very poor. The problem is heading drift.
48 The longer plane flies without magnethometer or GPS, the bigger is course estimation error.
50 After few minutes and few turns, "North" direction estimation can be completely broken.
51 In general, accuracy is enough to perform RTH U-turn when both RC controls and GPS are lost, and roughtly keep RTH direction in areas with occasional GPS outages.
53 ![image](https://github.com/RomanLut/inav/assets/11955117/3d5c5d10-f43a-45f9-a647-af3cca87c4da)
55 (purple line - estimated position, black line - real position).
57 It is recommened to use GPS fix estimation without magnethometer as last resort only. For example, if plane is flying above lake, landing means loss of plane. With GPS Fix estimation, plane will try to do RTH in very rought direction, instead of landing.
59 It is up to user to estimate the risk of fly-away.
64 GPS Fix estimation is enabled with CLI command:
66 ```set inav_allow_gps_fix_estimation=ON```
68 Also you have to specify cruise airspeed of the plane.
70 To find out cruise airspeed, make a test flight. Enable ground speed display on OSD. Flight in CRUISE mode in two opposite directions. Take average speed.
72 Cruise airspeed is specified in cm/s.
74 To convert km/h to m/s, multiply by 27.77.
77 Example: 100 km/h = 100 * 27.77 = 2777 cm/s
79 ```set fw_reference_airspeed=2777```
81 *It is important, that plane fly with specified speed in CRUISE mode. If you have set option "Increase cruise speed with throttle" - do not use it without GPS Fix.*
83 *If pitot is available, pitot sensor data will be used instead of constant. It is not necessary to specify fw_reference_airspeed. However, it is still adviced to specify for the case of pitot failure.*
85 *Note related command: to continue mission without RC signal, see command ```set failsafe_mission_delay=-1```.*
87 **After entering CLI command, make sure that settings are saved:**
91 # Disabling GPS sensor from RC controller
93 ![](Screenshots/programming_disable_gps_sensor_fix.png)
95 For testing purposes, it is possible to disable GPS sensor fix from RC controller in programming tab:
97 *GPS can be disabled only after: 1) initial GPS fix is acquired 2) in ARMED mode.*
99 # Allowing wp missions with GPS Fix estimation
101 ```failsafe_gps_fix_estimation_delay```
103 Controls whether waypoint mission is allowed to proceed with gps fix estimation. Sets the time delay in seconds between gps fix lost event and RTH activation. Minimum delay is 7 seconds. If set to -1 the mission will continue until the end. With default setting(7), waypoint mission is aborted and switched to RTH with 7 seconds delay. RTH is done with GPS Fix estimation. RTH is trigerred regradless of failsafe procedure selected in configurator.
105 # Expected error (mag + baro)
107 Realistic expected error is up to 200m per 1km of flight path. In tests, 500m drift per 5km path was seen.
110 - fly one large circle with GPS available to get good wind estimation
111 - use airspeed sensor. If airspeed sensor is not installed, fly in cruise mode without throttle override.
112 - do smooth, large turns
113 - make sure compass is pointing in nose direction precicely
114 - calibrate compass correctly
116 This video shows real world test where GPS was disabled occasionally. Wind is 10km/h south-west:
119 https://github.com/RomanLut/inav/assets/11955117/0599a3c3-df06-4d40-a32a-4d8f96140592
122 Purple line shows estimated position. Black line shows real position. "EST ERR" sensor shows estimation error in metters. Estimation is running when satellite icon displays "ES". Estimated position snaps to real position when GPS fix is reaquired.
125 # Is it possible to implement this for multirotor ?
127 There are some ideas, but there is no solution now. We can not make assumptions with multirotor which we can make with a fixed wing.
132 INAV HITL https://github.com/RomanLut/INAV-X-Plane-HITL