mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-08 17:08:28 -04:00
AP_NavEKF2: Don't update yaw estimator with bad GPS
This commit is contained in:
parent
1250f62c88
commit
e5e8d0ba3c
@ -557,7 +557,7 @@ void NavEKF2_core::runYawEstimatorPrediction()
|
|||||||
|
|
||||||
void NavEKF2_core::runYawEstimatorCorrection()
|
void NavEKF2_core::runYawEstimatorCorrection()
|
||||||
{
|
{
|
||||||
if (yawEstimator != nullptr && frontend->_fusionModeGPS <= 1) {
|
if (yawEstimator != nullptr && frontend->_fusionModeGPS <= 1 && EKFGSF_run_filterbank) {
|
||||||
if (gpsDataToFuse) {
|
if (gpsDataToFuse) {
|
||||||
Vector2f gpsVelNE = Vector2f(gpsDataDelayed.vel.x, gpsDataDelayed.vel.y);
|
Vector2f gpsVelNE = Vector2f(gpsDataDelayed.vel.x, gpsDataDelayed.vel.y);
|
||||||
float gpsVelAcc = fmaxf(gpsSpdAccuracy, frontend->_gpsHorizVelNoise);
|
float gpsVelAcc = fmaxf(gpsSpdAccuracy, frontend->_gpsHorizVelNoise);
|
||||||
|
@ -391,11 +391,11 @@ void NavEKF2_core::detectFlight()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle reset of counters used to control how many times we will try to reset the yaw to the EKF-GSF value per flight
|
// handle reset of counters used to control how many times we will try to reset the yaw to the EKF-GSF value per flight
|
||||||
if (!prevOnGround && onGround) {
|
if ((!prevOnGround && onGround) || !gpsAccuracyGood) {
|
||||||
// landed so disable filter bank
|
// disable filter bank
|
||||||
EKFGSF_run_filterbank = false;
|
EKFGSF_run_filterbank = false;
|
||||||
} else if (yawEstimator != nullptr && !prevInFlight && inFlight) {
|
} else if (yawEstimator != nullptr && !EKFGSF_run_filterbank && inFlight && gpsAccuracyGood) {
|
||||||
// started flying so reset counters and enable filter bank
|
// flying so reset counters and enable filter bank when GPS is good
|
||||||
EKFGSF_yaw_reset_ms = 0;
|
EKFGSF_yaw_reset_ms = 0;
|
||||||
EKFGSF_yaw_reset_request_ms = 0;
|
EKFGSF_yaw_reset_request_ms = 0;
|
||||||
EKFGSF_yaw_reset_count = 0;
|
EKFGSF_yaw_reset_count = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user