The EKF threw the compass heading away and took one worked out from GPS
What ArduPilot says:
- EKF2 IMUN emergency yaw reset
- EKF3 IMUN emergency yaw reset
The heading held by the EKF, ArduPilot's position and attitude estimator, was so wrong that its velocity stopped following the GPS. Just before declaring an EKF failsafe the aircraft asks for this rescue: the EKF replaces its heading with one worked out from GPS velocity and the IMU alone (the GSF yaw estimator), resets velocity and position to the GPS, and stops using the compass for the rest of the flight. EK3_GSF_RST_MAX (2 by default) limits how many times per flight. IMU numbers the EKF copy, from 0.
What to do, most likely first
Motor current disturbs the compass at high throttle, so the heading swings in flight.
CheckIn the log the compass readings follow the battery current; the reset came during a climb or a fast run.
FixLand and do not fly again until it is fixed: move the compass away from the power wiring and run the compass-motor calibration.
The aircraft took off with a wrong heading: steel at the take-off spot, or a compass with a wrong orientation or calibration.
CheckThe reset came within the first seconds of flight; before take-off the heading in the ground station did not match the real one.
FixCheck the compass orientation and calibrate it again; take off away from metal, and compare the heading on the map with the real one before every flight.
The GPS, not the compass, was wrong: a glitch or spoofing made the GPS velocity point the wrong way.
CheckThe satellite count or HDOP changed at that moment, and the position on the map jumped.
FixTake over in a mode that needs no position and land. The compass stays unused after the reset: reboot before the next flight.
Parameters to look at
| Parameter | What it is |
|---|---|
EK3_GSF_USE_MASK | Bitmask of which EKF-GSF yaw estimators are used |
EK3_GSF_RUN_MASK | Bitmask of which EKF-GSF yaw estimators run |
EK3_GSF_RST_MAX | Maximum number of resets to the EKF-GSF yaw estimate allowed |
COMPASS_USE | Use compass for yaw |
Where to do it:Failsafe ExplainerSetup & Tuning GuideSetup & Tuning Guide
The code that sends it
EKF2 IMUN emergency yaw reset
libraries/AP_NavEKF2/AP_NavEKF2_MagFusion.cpp NavEKF2_core::EKFGSF_resetMainFilterYaw() · Open in ArduPilot Copter-4.7.1
EKF3 IMUN emergency yaw reset
libraries/AP_NavEKF3/AP_NavEKF3_MagFusion.cpp NavEKF3_core::EKFGSF_resetMainFilterYaw() · Open in ArduPilot Copter-4.7.1