mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-06 19:00:27 +08:00
AP_AHRS: frontend makes own decision on airspeed use
decouples the airspeed's choice as to whether to use an airspeed sensor from DCM's
This commit is contained in:
committed by
Peter Barker
parent
8ad9ae2314
commit
2abbb7e332
@@ -729,12 +729,14 @@ bool AP_AHRS::using_airspeed_sensor() const
|
||||
return state.airspeed_estimate_type == AirspeedEstimateType::AIRSPEED_SENSOR;
|
||||
}
|
||||
|
||||
#if AP_AIRSPEED_ENABLED
|
||||
/*
|
||||
Return true if a airspeed sensor should be used for the AHRS airspeed estimate
|
||||
*/
|
||||
bool AP_AHRS::_should_use_airspeed_sensor(uint8_t airspeed_index) const
|
||||
{
|
||||
if (!airspeed_sensor_enabled(airspeed_index)) {
|
||||
const auto *airspeed = AP::airspeed();
|
||||
if (airspeed == nullptr || !airspeed->healthy(airspeed_index) || !airspeed->use(airspeed_index)) {
|
||||
return false;
|
||||
}
|
||||
nav_filter_status filter_status;
|
||||
@@ -751,6 +753,7 @@ bool AP_AHRS::_should_use_airspeed_sensor(uint8_t airspeed_index) const
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif // AP_AIRSPEED_ENABLED
|
||||
|
||||
// return an airspeed estimate if available. return true
|
||||
// if we have an estimate
|
||||
|
||||
@@ -196,18 +196,6 @@ public:
|
||||
// active backend
|
||||
bool airspeed_sensor_data_being_consumed(void) const;
|
||||
|
||||
// return true if a airspeed sensor is enabled
|
||||
bool airspeed_sensor_enabled(void) const {
|
||||
// FIXME: make this a method on the active backend
|
||||
return AP_AHRS_Backend::airspeed_sensor_enabled();
|
||||
}
|
||||
|
||||
// return true if a airspeed from a specific airspeed sensor is enabled
|
||||
bool airspeed_sensor_enabled(uint8_t airspeed_index) const {
|
||||
// FIXME: make this a method on the active backend
|
||||
return AP_AHRS_Backend::airspeed_sensor_enabled(airspeed_index);
|
||||
}
|
||||
|
||||
// true if compass is being used
|
||||
bool use_compass();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user