From f0781f15a150ea6fc0c3ad803fd9cce48fbfeabb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 20 Aug 2020 14:10:04 +1000 Subject: [PATCH] AP_NavEKF2: apply min GPS accuracy at measurement point this fixes an issue a RTK GPS gives 1cm horizontal and vertical accuracy and that causes the variances to get too small --- libraries/AP_NavEKF2/AP_NavEKF2_Measurements.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/AP_NavEKF2/AP_NavEKF2_Measurements.cpp b/libraries/AP_NavEKF2/AP_NavEKF2_Measurements.cpp index 608f0ce109..a5db1f2232 100644 --- a/libraries/AP_NavEKF2/AP_NavEKF2_Measurements.cpp +++ b/libraries/AP_NavEKF2/AP_NavEKF2_Measurements.cpp @@ -511,6 +511,7 @@ void NavEKF2_core::readGpsData() } else { gpsSpdAccuracy = MAX(gpsSpdAccuracy,gpsSpdAccRaw); gpsSpdAccuracy = MIN(gpsSpdAccuracy,50.0f); + gpsSpdAccuracy = MAX(gpsSpdAccuracy,frontend->_gpsHorizVelNoise); } gpsPosAccuracy *= (1.0f - alpha); float gpsPosAccRaw; @@ -519,6 +520,7 @@ void NavEKF2_core::readGpsData() } else { gpsPosAccuracy = MAX(gpsPosAccuracy,gpsPosAccRaw); gpsPosAccuracy = MIN(gpsPosAccuracy,100.0f); + gpsPosAccuracy = MAX(gpsPosAccuracy, frontend->_gpsHorizPosNoise); } gpsHgtAccuracy *= (1.0f - alpha); float gpsHgtAccRaw; @@ -527,6 +529,7 @@ void NavEKF2_core::readGpsData() } else { gpsHgtAccuracy = MAX(gpsHgtAccuracy,gpsHgtAccRaw); gpsHgtAccuracy = MIN(gpsHgtAccuracy,100.0f); + gpsHgtAccuracy = MAX(gpsHgtAccuracy, 1.5f * frontend->_gpsHorizPosNoise); } // check if we have enough GPS satellites and increase the gps noise scaler if we don't