EKFdrone safetyflight logsUAV technology

Understanding EKF Innovation Spikes and Their Impact on Flight Safety

LogHat AIMarch 27, 20265 min read

Key Takeaway

EKF innovation spikes can significantly impact flight safety in drone navigation.

Understanding EKF Innovation Spikes and Their Impact on Flight Safety

TL;DR: EKF innovation spikes occur when sensor measurements deviate from predicted state estimates beyond threshold gates like EK3_POS_I_GATE = 500. They trigger navigation failsafes and are diagnosed via NKF1.PI, NKF4.SV, and GPS.HDop values in logs.

EKF innovation spikes are a common cause of navigation-related failsafes in ArduPilot and PX4 drones. When the Extended Kalman Filter detects sensor measurements that contradict its internal state predictions, it flags innovation test failures. This protection mechanism prevents bad sensor data from corrupting navigation, but undiagnosed spikes cause unexpected RTL triggers, position drift, and mid-air mode switches. Flight engineers need to identify the sensor source—GPS glitches, compass interference, or vibration-induced accelerometer noise—to fix the root cause.

What Causes EKF Innovation Spikes in ArduPilot and PX4?

Innovation is the difference between what the EKF predicts and what a sensor actually measures. The filter calculates position innovation, velocity innovation, and magnetometer innovation for every sensor input. When this difference exceeds safety gates defined in parameters like EK3_POS_I_GATE = 500 or EK3_VEL_I_GATE = 500, the EKF flags a test failure and may reject that sensor.

Common triggers include GPS horizontal dilution of precision (GPS.HDop) exceeding 2.0 during satellite dropouts, magnetic interference creating compass deviation over 30°, and high-frequency vibration coupling into IMU measurements. Sudden airframe movements during aggressive manoeuvres also generate transient spikes as the prediction model lags actual dynamics.

In PX4, the estimator_innovations topic logs vel_innov[0], vel_innov[1], and pos_innov[0] fields. Values beyond 3-sigma thresholds trigger estimator_status.innovation_check_flags bits. ArduPilot uses NKF1.PI (position innovation magnitude) and NKF4.SV (velocity innovation test ratio) with lane-specific messages (NKF for primary lane, XKF for secondary).

Key Takeaway: Innovation spikes are the EKF's safety response to sensor disagreement. Identifying which sensor failed the innovation test—GPS, compass, or IMU—determines the fix.

How to Read EKF Innovation Values in Flight Logs

ArduPilot logs innovation metrics in the NKF1, NKF4, and XKF message groups. NKF1.PI represents position innovation magnitude in metres. Values below 0.3 are normal; above 0.5 during hover indicates sensor divergence. NKF4.SV shows velocity innovation test ratio (normalized)—values >1.0 indicate sensor measurements being rejected or weighted down by the filter.

NKF4.SP is the position innovation test ratio (normalized), following the same >1.0 rejection threshold. Check GPS.HDop simultaneously—ArduPilot typically requires HDop < 2.0 for GPS fusion. When GPS.HDop exceeds 2.0 and NKF1.PI spikes above 1.0, GPS accuracy degradation is the cause.

For compass issues, plot MAG.MagX/Y/Z against NKF3.IMX/Y/Z (EKF's predicted magnetic field). Deviations over 100 milligauss during constant heading indicate external interference. The EKF lane switching mechanism activates when primary lane innovation failures persist—watch for transitions from NKF to XKF message dominance in the log timeline.

PX4 engineers should monitor estimator_innovations.vel_innov[0] (north velocity innovation) and estimator_innovations.pos_innov[0] (north position innovation) in *.ulg logs. Cross-reference with vehicle_gps_position.eph (horizontal position uncertainty) to distinguish GPS quality degradation from filter tuning issues. See LogHat docs for automated threshold detection.

Key Takeaway: NKF1.PI > 0.5, NKF4.SV > 1.0, or GPS.HDop > 2.0 are red flags. Correlate spike timing with sensor health messages to isolate the failing component.

How to Prevent EKF Innovation Spikes Before Flight

Pre-flight calibration eliminates 80% of EKF failures. Perform compass calibration in the actual flight environment—not indoors near rebar or metal structures. ArduPilot's COMPASS_LEARN parameter enables in-flight calibration but should never replace proper ground calibration. Verify COMPASS_OFS_X/Y/Z values are under 400 and COMPASS_MOT_X/Y/Z offsets stay below 100.

GPS survey-in procedures reduce position innovation at takeoff. Power the flight controller for 5 minutes in a static position before arming. This allows the EKF to converge on accurate initial coordinates. Check GPS.NSats ≥ 10 and GPS.HDop < 1.0 before arming—never launch with marginal satellite lock.

Vibration damping installation prevents accelerometer noise coupling. Mount the flight controller on gel pads or O-rings to isolate it from motor vibrations. Log VIBE.VibeX/Y/Z during a bench motor test—values should stay under 30 m/s² at full throttle. High vibration creates aliasing in the IMU, producing velocity innovation spikes during climbs and descents.

Verify sensor orientation matches the AHRS_ORIENTATION parameter. A 180° yaw error causes instant EKF divergence on takeoff as GPS velocity contradicts IMU heading. Use Mission Planner's Setup > Mandatory Hardware > Accel Calibration to confirm all axes read correctly when the aircraft is level.

Key Takeaway: Proper compass calibration, GPS survey-in, vibration isolation, and sensor orientation verification eliminate most pre-flight EKF risks. Don't skip calibration to save 5 minutes.

Diagnosing EKF Spikes: GPS vs Compass vs IMU

Use this decision tree to isolate the failing sensor when NKF1.PI exceeds 0.5:

NKF1.PI > 0.5 Check GPS.HDop > 2.0 or NSats < 8? YES NO GPS Issue Check antenna/placement Check MAG deviation MAG vs NKF3.IMX/Y/Z > 100 mGauss? YES ↓ NO ↙ Compass Interference Recalibrate/relocate IMU/Vibration Issue Check VIBE.VibeX/Y/Z
EKF Innovation Spike Diagnostic Flowchart

GPS-induced spikes correlate with GPS.NSats dropping below 8 or GPS.HDop rising above 2.0. Check for RF interference from video transmitters on 1.2 GHz or 1.3 GHz bands near GPS L1 frequency (1575 MHz). Relocate the GPS module on a mast 10 cm above the airframe with full sky view.

Compass spikes appear as NKF4.SP > 1.0 during constant-heading flight. Power cables running near the compass, ESC magnetic fields, or steel reinforcement in concrete launch pads cause this. Switch to COMPASS_USE2 if

Tagged

EKFdrone safetyflight logsUAV technology

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