ekf2: reset heading when mag calibration changed

This commit is contained in:
bresch authored and Daniel Agar committed 2025-03-26 22:32:51 -04:00
1 parent 49624a6457
commit 82a482ec0b
1 file changed
+6
@@ -75,6 +75,12 @@ void Ekf::controlMagFusion(const imuSample &imu_sample)
_mag_lpf.reset(mag_sample.mag);
_mag_counter = 1;
if (!_control_status.flags.in_air) {
// Assume that a reset on the ground is caused by a change in mag calibration
// Clear alignment to force a clean reset
_control_status.flags.yaw_align = false;
}
} else {
_mag_lpf.update(mag_sample.mag);
_mag_counter++;