Skip to content
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

Merged
merged 3 commits into from
Oct 30, 2023

Conversation

IamPete1
Copy link
Member

@IamPete1 IamPete1 commented Oct 15, 2023

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.

if (active_EKF_type() == EKFType::THREE) {
uint8_t ret = EKF3.getActiveAirspeed();
if (ret != 255 && airspeed->healthy(ret)) {
return ret;
}
}

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.

@IamPete1 IamPete1 changed the title Ahrs airspeed fix AP_AHRS: check health of the same sensor were using. Oct 15, 2023
@@ -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()) {
Copy link
Member Author

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();
Copy link
Member Author

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.

@IamPete1 IamPete1 force-pushed the AHRS_Airspeed_fix branch 3 times, most recently from 6b73958 to 429245b Compare October 16, 2023 11:53
@Ryanf55 Ryanf55 self-requested a review October 23, 2023 01:18
@CraigElder CraigElder changed the title AP_AHRS: check health of the same sensor were using. AP_AHRS: ensure we check health of the sensor are using. Oct 23, 2023
@CraigElder CraigElder changed the title AP_AHRS: ensure we check health of the sensor are using. AP_AHRS: ensure we check health of the sensor we are using. Oct 23, 2023
@tridge tridge merged commit 97101b6 into ArduPilot:master Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants