-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AP_AHRS: ensure we check health of the sensor we are using. #25272
Conversation
@@ -832,8 +841,8 @@ bool AP_AHRS::airspeed_sensor_enabled(void) const | |||
bool AP_AHRS::_airspeed_estimate(float &airspeed_ret, AirspeedEstimateType &airspeed_estimate_type) const | |||
{ | |||
#if AP_AIRSPEED_ENABLED && AP_GPS_ENABLED | |||
if (airspeed_sensor_enabled()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the issues were fixing, this line checks the PRIMARY sensor is set to use and healthy.
@@ -832,8 +841,8 @@ bool AP_AHRS::airspeed_sensor_enabled(void) const | |||
bool AP_AHRS::_airspeed_estimate(float &airspeed_ret, AirspeedEstimateType &airspeed_estimate_type) const | |||
{ | |||
#if AP_AIRSPEED_ENABLED && AP_GPS_ENABLED | |||
if (airspeed_sensor_enabled()) { | |||
uint8_t idx = get_active_airspeed_index(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function may then return another sensor which is not the PRIMARY so it could be set to not use, or unhealthy. Or conversely we could not be using a backup sensor because the primary is not healthy or not set to use.
6b73958
to
429245b
Compare
429245b
to
294f5da
Compare
The
airspeed_sensor_enabled()
function checks the primary sensor, however, we may not be using the primary sensor thanks to affinity.The problem is whenever affinity tries to use a sensor other than primary. It checks health, but not use.
ardupilot/libraries/AP_AHRS/AP_AHRS.cpp
Lines 3080 to 3085 in e0a0129
I should add that I have not checked if affinity could actually try and use a sensor which is not set to use. So this may or may-not be possible to hit this issue.