From 8aee45dd9613b239e7a37ddf3d69c3d392fc8268 Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Sat, 5 Nov 2016 09:36:06 +1100 Subject: [PATCH] EKF: Fix bug causing repeated resets if GPS sensor disconnected --- EKF/control.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EKF/control.cpp b/EKF/control.cpp index 42cce4cf99..c915035608 100644 --- a/EKF/control.cpp +++ b/EKF/control.cpp @@ -405,8 +405,8 @@ void Ekf::controlGpsFusion() } } else { - // handle the case where we do not have GPS and have not been using it for an extended period - if ((_time_last_imu - _time_last_gps > 10e6) && (_time_last_imu - _time_last_airspeed > 1e6) && (_time_last_imu - _time_last_optflow > 1e6)) { + // handle the case where we do not have GPS and have not been using it for an extended period, but are still relying on it + if ((_time_last_imu - _time_last_gps > 10e6) && (_time_last_imu - _time_last_airspeed > 1e6) && (_time_last_imu - _time_last_optflow > 1e6) && _control_status.flags.gps) { // if we don't have a source of aiding to constrain attitude drift, // then we need to switch to the non-aiding mode, zero the velocity states // and set the synthetic GPS position to the current estimate