From 2eb627775aec531b56602d69a2a816c302f04c02 Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Mon, 21 Nov 2022 20:28:20 +1100 Subject: [PATCH] AP_NavEKF3: Prevent on ground range to ground being used in flight --- libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp b/libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp index 5398f7acac..d2559438cc 100644 --- a/libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp +++ b/libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp @@ -90,7 +90,7 @@ void NavEKF3_core::readRangeFinder(void) // indicate we have updated the measurement rngValidMeaTime_ms = imuSampleTime_ms; - } else if (!takeOffDetected && ((imuSampleTime_ms - rngValidMeaTime_ms) > 200)) { + } else if (onGround && ((imuSampleTime_ms - rngValidMeaTime_ms) > 200)) { // before takeoff we assume on-ground range value if there is no data rangeDataNew.time_ms = imuSampleTime_ms; rangeDataNew.rng = rngOnGnd;