ekf2-mag: with NE aiding, constrain heading drift only before takeoff

After takeoff, the heading is easily observable
This commit is contained in:
bresch
2024-05-31 10:38:17 -04:00
committed by Daniel Agar
parent 3dac9af09e
commit 53210dd8f3
3 changed files with 318 additions and 318 deletions
@@ -180,7 +180,7 @@ void Ekf::controlMagFusion()
// if we are using 3-axis magnetometer fusion, but without external NE aiding,
// then the declination must be fused as an observation to prevent long term heading drift
const bool no_ne_aiding_or_pre_takeoff = !using_ne_aiding || !_control_status.flags.mag_aligned_in_flight;
const bool no_ne_aiding_or_pre_takeoff = !using_ne_aiding || !_control_status.flags.in_air;
_control_status.flags.mag_dec = _control_status.flags.mag && no_ne_aiding_or_pre_takeoff;
if (_control_status.flags.mag) {