From bb74371c5886b3699561b5401925b9348d7e31b7 Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Sat, 27 Feb 2016 10:58:38 +1100 Subject: [PATCH] AP_NavEKF2: Do not use GPS height if GPS accuracy is poor If we are using GPS height, revert back to using Baro height if the GPS accuracy is poor. --- libraries/AP_NavEKF2/AP_NavEKF2_PosVelFusion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_NavEKF2/AP_NavEKF2_PosVelFusion.cpp b/libraries/AP_NavEKF2/AP_NavEKF2_PosVelFusion.cpp index f3fc5f6637..f99e5bed56 100644 --- a/libraries/AP_NavEKF2/AP_NavEKF2_PosVelFusion.cpp +++ b/libraries/AP_NavEKF2/AP_NavEKF2_PosVelFusion.cpp @@ -552,7 +552,7 @@ void NavEKF2_core::selectHeightForFusion() // determine if we should be using a height source other than baro bool usingRangeForHgt = (frontend->_altSource == 1 && imuSampleTime_ms - rngValidMeaTime_ms < 500 && frontend->_fusionModeGPS == 3); - bool usingGpsForHgt = (frontend->_altSource == 2 && imuSampleTime_ms - lastTimeGpsReceived_ms < 500 && validOrigin); + bool usingGpsForHgt = (frontend->_altSource == 2 && imuSampleTime_ms - lastTimeGpsReceived_ms < 500 && validOrigin && gpsAccuracyGood); // if there is new baro data to fuse, calculate filterred baro data required by other processes if (baroDataToFuse) {