EKF2 Height Reset Snapping to Baro raw height, 40m alt difference

Hi,

Summary

During a flight using baro as the height reference (EKF2_HGT_REF = 0) with GPS height fusion also enabled (EKF2_GPS_CTRL = 7), a barometer spike caused the EKF2 to trigger a height reset that snapped the estimated altitude to the raw baro value rather than the baro height adjusted for take-off height. This resulted in a ~40m jump in the fused altitude estimate.

Firmware

custom 1.14.0

Setup

  • Height reference: Barometer (EKF2_HGT_REF = 0)

  • GPS fusion: Enabled including altitude and 3D velocity (EKF2_GPS_CTRL = 7)

  • Flight conditions: Dynamic flight with wind, which is known to cause baro pressure disturbances

What Happened

At t=85s a barometer pressure transient caused a large spike in the baro altitude reading. The EKF2 innovation exceeded the gate threshold and triggered a Z position reset (z_reset_counter incremented). The height state was reset to the baro spike value.

At the moment of reset, the sensor values (adj = takeoff-adjusted, offset removed) were:

  • baro_takeoff_adj = ~35.4m ← baro height relative to takeoff at the moment of reset

  • gps_alt_takeoff_adj = ~26.4m ← GPS height relative to takeoff, stable and physically consistent

  • vehicle_local_position/z (pre-reset) = ~28m ← EKF height estimate just before reset

  • vehicle_global_position/alt = the fused altitude, jumps from 32m to 70m

  • gps_alt_baro_diff = difference between gps alt and baro both with offset removed (start at 0 alt),

The EKF reset the height state to ~71m — the outlier value that triggered the reset — rather than the baro altitude adjusted for takeoff height of ~35-40m which would have been the correct reset target.
Without knowing too much of the inner workings of the EKF, but this seems to be an incorrect reset behavior.

flight review log: