From e3d73cd837806b4f3e6e59d81a2ae02facee4b29 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Thu, 2 Feb 2023 10:14:22 -0500 Subject: [PATCH] ekf2: mag control reset mag_lpf on first sample --- src/modules/ekf2/EKF/mag_control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/ekf2/EKF/mag_control.cpp b/src/modules/ekf2/EKF/mag_control.cpp index f17f1ef133..0291ca0427 100644 --- a/src/modules/ekf2/EKF/mag_control.cpp +++ b/src/modules/ekf2/EKF/mag_control.cpp @@ -51,7 +51,7 @@ void Ekf::controlMagFusion() if (mag_data_ready) { // sensor or calibration has changed, clear any mag bias and reset low pass filter - if (mag_sample.reset) { + if (mag_sample.reset || (_mag_counter == 0)) { // Zero the magnetometer bias states _state.mag_B.zero();