
Understanding EKF Innovation Spikes in ArduPilot Logs
Key Takeaway
ArduPilot EKF innovations live in XKF3 (IVN/IVE/IVD for velocity, IPN/IPE/IPD for position). XKF4 test ratios SV/SP/SH are squared innovation gates — values above 1 mean the EKF rejected the measurement. Sustained SP above 0.5 with rising SS bits is what triggers the EKF check and ultimately failsafe.
TL;DR: EKF innovations are the heart of position-control safety in ArduPilot. XKF3.IVN/IVE/IVD measure the disagreement between what the EKF expected and what the sensors reported. XKF4.SV/SP/SH are normalised test ratios — a value above 1 means that measurement was rejected. Sustained XKF4.SP above 0.5 with rising XKF4.SS bits is what the EKF check uses to trigger lane switch and ultimately EKF failsafe. Most innovation spikes trace to GPS multipath, magnetometer interference, or vibration corrupting IMU integration.
What "innovation" means in EKF terms
Innovation is the residual between the EKF's prediction of a measurement and the actual measurement. When the GPS reports velocity north, the EKF compares it to its own predicted north velocity and writes the difference into XKF3.IVN. Small innovations mean the model and sensors agree; large innovations mean either the model is wrong, the sensor is wrong, or both.
The same machinery runs for position, magnetometer readings, yaw, and airspeed. Each measurement family has its own innovation channel in XKF3 (for EKF3, the default) and the equivalent in NKF3 if you're running EKF2.
The XKF3 fields you'll actually read
XKF3 TimeUS C IVN IVE IVD IPN IPE IPD IMX IMY IMZ IYAW IVT RErr ErSc
C— which EKF core this row belongs to. ArduPilot runs multiple cores in parallel;XKF4.PItells you which is primary.IVN/IVE/IVD— velocity innovations in m/s, north/east/down.IPN/IPE/IPD— position innovations in metres, north/east/down.IMX/IMY/IMZ— magnetometer innovations.IYAW— yaw innovation, in radians.IVT— airspeed innovation (Plane).RErr— this core's accumulated relative error against the active primary core.ErSc— consolidated error score; higher means less healthy.
The XKF4 test ratios — the most useful number in the log
XKF4 TimeUS C SV SP SH SM SVT errRP OFN OFE FS TS SS GPS PI
The headline numbers are SV, SP, and SH. These are not raw innovations — they're squared innovation test ratios normalised against the EKF's expected uncertainty for that measurement. A value below 1 means the measurement passed the gate and was used; a value above 1 means it was rejected. That single rule makes XKF4.SP the cleanest health indicator in the log.
SV— velocity test ratio.SP— position test ratio. The most watched.SH— height test ratio.SM— magnetometer test ratio.SVT— airspeed test ratio (Plane).FS— filter fault status bitmask.SS— solution status bitmask; tells you which sensors are actively trusted right now.PI— primary core index. A change here is a lane switch.
Confirming a spike in Mission Planner
Plot XKF3.IPN, XKF3.IPE, and XKF4.SP on one axis. A real disturbance shows up as a position innovation excursion followed by the SP test ratio crossing 1 — that's the firmware logging "I just rejected a GPS update". The EKF is allowed to clear test ratios over time as fresh measurements come in; if SP stays above 0.5 for sustained periods you have a stuck disagreement, not a transient glitch.
Confirming it in MAVExplorer
MAV> graph XKF3.IVN XKF3.IVE XKF3.IVD
MAV> graph XKF4.SV XKF4.SP XKF4.SH
MAV> graph XKF4.PI
If XKF4.PI goes from 0 to 1 (or 1 to 0) mid-flight, that's a lane switch. Two switches within a few seconds is a sign the EKF can't pick a primary it trusts.
Why innovations spike — ranked by what we see most often
- GPS multipath or RFI. Position innovations climb because the GPS reports a position physics says you can't be at. See our GPS glitch post for the receiver-side story.
- Magnetometer interference. Current-draw peaks bias the compass;
XKF3.IMX/Y/Zgrow as a function of throttle.COMPASSMOTcalibration and physical separation are the fixes. - Severe vibration.
VIBE.VibeZabove 30 m/s² corrupts IMU integration, so the EKF's predicted velocity grows incorrectly — innovations chase that error. The cause is mechanical, not EKF-tunable. See our VIBE message guide for the mitigation chain. - Aggressive manoeuvres. Sharp pitches can transiently spike
XKF3.IVD. If the spike is short and SP doesn't cross 1, this is normal. - Bad airspeed (Plane).
XKF3.IVTclimbing during cruise is your tell that the pitot orARSPD_RATIOcalibration is off.
Tuning the gates — carefully
Each measurement family has an innovation gate parameter expressed in tenths of standard deviations:
EK3_POS_I_GATE— GPS position. Default 500 (5.0 sigma).EK3_VEL_I_GATE— GPS velocity.EK3_HGT_I_GATE— barometer height.EK3_MAG_I_GATE— magnetometer.EK3_YAW_I_GATE— compass yaw.
Raising a gate makes the filter more tolerant of noisy sensors but lets through bad measurements that would otherwise have been rejected. Lower one only if you understand exactly what your sensor's noise floor is — tightening the gate on a vehicle with real EMI gives you constant EKF failsafes. The gates are a backstop, not a fix.
From innovation spike to lane switch to failsafe
ArduPilot escalates in three steps:
- Innovation arrives high. EKF rejects the measurement;
XKF4.SPcrosses 1 for one update. - If multiple rejections accumulate, the EKF check (running at 10 Hz) writes
ERR Subsys=16 ECode=2(EKFCHECK_BAD_VARIANCE). - If the bad variance condition persists past
FS_EKF_THRESHforFS_EKF_ACTION-determined duration, the autopilot triggers EKF failsafe —ERR Subsys=17 ECode=1— and lane-switches the EKF core (XKF4.PIflips). If the secondary core is also bad, the autopilot drops to Land.
Reading that chain top-to-bottom in the log tells you whether you saw a transient (single SP spike that cleared) or a degradation (failsafe fired).
When LogHat helps — and when it doesn't
LogHat plots XKF3 and XKF4 with the rejection thresholds drawn on the axis and annotates lane switches in the 3D replay timeline. What we can't do is tell you which physical sensor degraded — that needs you to swap hardware or run a hover-stand measurement. The log narrows the search to magnetometer, GPS, or vibration with high confidence; the screwdriver work is yours.
About the author
LogHat Engineering Team
The LogHat engineering team — drone-systems engineers who build and operate the LogHat flight analytics platform. Posts in this byline are written and reviewed by team members working on the parsers, analysis engine, and Vector AI that the post describes.
Tagged
Try LogHat
Analyze your flight logs in seconds
Upload a .bin, .tlog, .log, or .ulg file. Get AI crash analysis, 3D replay, and forensic PDF reports instantly.
Try LogHat Free