AP_AHRS: use EKF rejecting_airspeed flag

stop using airspeed sensor when EKF is rejecting the sensor
This commit is contained in:
Andrew Tridgell 2022-01-26 17:36:13 +11:00
parent 9dcff1a23f
commit 01ac314837
2 changed files with 23 additions and 4 deletions

View File

@ -816,6 +816,28 @@ Vector3f AP_AHRS::wind_estimate(void) const
return wind;
}
/*
return true if a real airspeed sensor is enabled
*/
bool AP_AHRS::airspeed_sensor_enabled(void) const
{
if (!dcm.airspeed_sensor_enabled()) {
return false;
}
nav_filter_status filter_status;
if (fly_forward &&
hal.util->get_soft_armed() &&
get_filter_status(filter_status) &&
filter_status.flags.rejecting_airspeed) {
// special case for when backend is rejecting airspeed data in
// an armed fly_forward state. Then the airspeed data is
// highly suspect and will be rejected. We will use the
// synthentic airspeed instead
return false;
}
return true;
}
// return an airspeed estimate if available. return true
// if we have an estimate
bool AP_AHRS::airspeed_estimate(float &airspeed_ret) const

View File

@ -158,10 +158,7 @@ public:
// return true if airspeed comes from an airspeed sensor, as
// opposed to an IMU estimate
bool airspeed_sensor_enabled(void) const {
// FIXME: make this "using_airspeed_sensor"?
return dcm.airspeed_sensor_enabled();
}
bool airspeed_sensor_enabled(void) const;
// return true if airspeed comes from a specific airspeed sensor, as
// opposed to an IMU estimate