From 4ddf0f9dc1d177ead6ab987c5b534027f8883aca Mon Sep 17 00:00:00 2001 From: RomanBapst Date: Tue, 10 Mar 2020 09:29:34 +0300 Subject: [PATCH] ekf2_main.cpp: fixed bug in the calculation of the mag bias calibration time Signed-off-by: RomanBapst --- src/modules/ekf2/ekf2_main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/ekf2/ekf2_main.cpp b/src/modules/ekf2/ekf2_main.cpp index 9eac764ed3..efe92e4a13 100644 --- a/src/modules/ekf2/ekf2_main.cpp +++ b/src/modules/ekf2/ekf2_main.cpp @@ -1551,6 +1551,11 @@ void Ekf2::Run() for (bool &cal_available : _valid_cal_available) { cal_available = false; } + + } else { + // conditions are NOT OK for learning magnetometer bias, reset timestamp + // but keep the accumulated calibration time + _last_magcal_us = now; } // Start checking mag bias estimates when we have accumulated sufficient calibration time