
Understanding EKF Innovation Spikes for Drone Flight Safety
Key Takeaway
EKF innovation spikes are critical for ensuring drone flight safety.
# Understanding EKF Innovation Spikes for Drone Flight Safety
<blockquote class="tldr">
<strong>TL;DR:</strong> EKF innovation spikes occur when sensor data disagrees with predicted position by more than 5 meters, triggering failsafe events that can force emergency landings or flight mode changes in ArduPilot and PX4.
</blockquote>
The Extended Kalman Filter (EKF) is the mathematical brain that fuses GPS, IMU, barometer, and compass data into a single best-estimate of your drone's position and velocity. When sensor measurements deviate significantly from EKF predictions, the resulting innovation spikes can trigger failsafe events that ground your aircraft mid-flight. ArduPilot engineers working with flight logs see these spikes as the number one cause of unexpected EKF failsafe events. This guide explains how to identify, diagnose, and prevent EKF innovation spikes using real log analysis techniques.
<h2>What Do EKF Innovation Values Actually Measure?</h2>
Innovation values represent the difference between what the EKF predicts your drone's state should be and what the sensors actually report. In ArduPilot, position innovations appear as <code>NKF4.IPN</code>, <code>NKF4.IPE</code>, and <code>NKF4.IPD</code> (North, East, Down position innovations in meters). These values directly measure how far the sensor-reported position differs from the EKF's predicted position.
Normal flight shows position innovations below 2 meters. Values between 2-5 meters indicate sensor stress or minor GPS multipath. Values above 5 meters trigger EKF health warnings. When position innovations exceed 8-10 meters, ArduPilot raises <code>PREARM: EKF variance</code> errors or mid-flight <code>EKF failsafe</code> events depending on <code>FS_EKF_THRESH</code> settings.
The EKF doesn't simply compare raw measurements to thresholds. It calculates innovation variance ratios — the innovation squared divided by the predicted measurement uncertainty. When this ratio exceeds <code>EKF_CHECK_THRESH</code>, the EKF flags that sensor as unhealthy. This statistical approach prevents false positives from normal sensor noise while catching genuine divergence quickly.
<blockquote><strong>Key Takeaway:</strong> Position innovations above 5m indicate serious sensor-prediction disagreement. Check <code>NKF4.IPN/IPE/IPD</code> in your logs first when diagnosing EKF failsafe events.</blockquote>
<h2>Why Do Innovation Spikes Happen During Flight?</h2>
The three most common causes are vibration-induced IMU errors, GPS glitches, and magnetic interference. Each creates a distinct pattern in the logs.
Vibration causes high-frequency noise in accelerometer readings, which the EKF integrates into position predictions. When GPS updates arrive every 200ms showing a smooth trajectory, the EKF-predicted position (corrupted by vibration) diverges from GPS reality. Check <code>VIBE.VibeX/Y/Z</code> values above 30 m/s² and <code>VIBE.Clip0/1/2</code> counts above zero. IMU clipping occurs when accelerations exceed ±15.6 m/s² — the point where ArduPilot's hardware registers maximum values and loses accuracy.
GPS glitches show as sudden jumps in <code>GPS.NSats</code>, spikes in <code>GPS.HDop</code> above 2.0, or velocity changes in <code>GPS.Spd</code> that don't match IMU integration. Urban environments, RF interference from 2.4GHz video transmitters, and poor satellite geometry all cause GPS position jumps of 5-20 meters. The EKF correctly rejects these as outliers, causing temporary innovation spikes while it waits for GPS to stabilise.
Magnetic interference creates velocity innovations when compass heading suddenly shifts. Since velocity is derived from GPS position changes and heading, a 15° compass error during a 10 m/s flight creates a 2.5 m/s velocity error. Check <code>MAG.Health</code> flags and compare <code>MAG.MagX/Y/Z</code> against expected Earth field values for your location.
<blockquote><strong>Key Takeaway:</strong> Innovation spikes have root causes. Vibration affects IMU, GPS glitches affect position, magnetic interference affects heading-derived velocity. Check all three sensor groups when diagnosing.</blockquote>
<h2>How to Diagnose the Root Cause in Flight Logs</h2>
Start by plotting <code>NKF4.IPN</code>, <code>NKF4.IPE</code>, and <code>NKF4.IPD</code> against time in Mission Planner or <a href="https://www.loghat.app/docs">LogHat docs</a>. Look for spikes above 5 meters that correlate with <code>ERR</code> messages showing <code>Subsys=10</code> (EKF) and <code>ECode=2</code> (variance).
Next, overlay <code>VIBE.VibeX</code>, <code>VIBE.VibeY</code>, <code>VIBE.VibeZ</code> on the same timeline. Vibration-induced spikes show sustained high VIBE values (above 30 m/s²) preceding the innovation spike by 2-5 seconds. Check <code>VIBE.Clip0</code>, <code>VIBE.Clip1</code>, and <code>VIBE.Clip2</code> — any non-zero values indicate IMU clipping at the hardware limit of approximately 15.6 m/s². This is a hard fault requiring mechanical fixes, not software tuning.
If VIBE is clean, check GPS health. Plot <code>GPS.NSats</code> (should stay above 10), <code>GPS.HDop</code> (should stay within the ranges of Excellent, Good, Moderate, and Poor), and <code>GPS.SAcc</code> (speed accuracy, should be below 0.5 m/s). A sudden drop in NSats or spike in HDop that precedes the innovation spike by 0.2-1.0 seconds confirms GPS as the culprit. Urban flights often show this pattern when satellites drop below building horizons.
For compass issues, enable <code>COMPASS_LEARN</code> and check <code>MAG.OfsX/Y/Z</code> drift. If offsets change by more than 100 units during flight, you have magnetic interference from power cables or ESC currents. Compare multiple compass instances: <code>MAG.MagX</code> vs <code>MAG2.MagX</code> should agree within 50 units. Disagreement indicates one compass is compromised.
Do not lower <code>INS_ACCEL_FILTER</code> to mask vibration. The default 20 Hz notch filter is engineered for ArduPilot's IMU sample rates. Aggressive filtering to 10 Hz introduces phase lag that degrades attitude control. Fix the mechanical vibration source — balance props, check motor bearings, add gel dampers, stiffen the frame.
<blockquote><strong>Key Takeaway:</strong> Time-align <code>NKF4</code> innovations with <code>VIBE</code>, <code>GPS</code>, and <code>MAG</code> data on the same plot. The root cause reveals itself through timing — which sensor degraded first.</blockquote>
<h2>How to Configure EKF Parameters to Reduce False Positives</h2>
ArduPilot's EKF parameters control both the sensitivity of innovation spike detection and the failsafe response. The key parameters are <code>EKF_CHECK_THRESH</code>, <code>FS_EKF_THRESH</code>, and <code>FS_EKF_ACTION</code>. Adjustments to these parameters can help fine-tune the EKF's responsiveness. For instance, <code>EK3_CHECK_THRESH</code> can be tuned to adjust EKF sensitivity — consult the ArduPilot parameter reference for current defaults.
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