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_Proximity: get_status() returns first good sensor status #25913

Merged
merged 2 commits into from
Mar 7, 2024

Conversation

rishabsingh3003
Copy link
Contributor

Currently, if multiple proximity sensors are configured and any one stops working, avoidance stops working. This can be dangerous as we still have some good sensors that might be available.
This will fix the issue.

@rmackay9
Copy link
Contributor

rmackay9 commented Jan 7, 2024

@rishabsingh3003,

How about removing the check of proximity sensor status from AC_Avoid and just rely on the _proximity.get_obstacle_count() working correctly?

As long as get_obstacle_count() properly handles a proximity sensor failing and does not return stale values then it should be sufficient. If it does keep returning stale values then we still have a problem even after this PR's fix.

@rishabsingh3003
Copy link
Contributor Author

Thanks, Randy. I have implemented what you have have asked in your comment and verified in SITL that it works as expected.

AP_Proximity::Status AP_Proximity::get_status() const
{
Status sensors_status = Status::NotConnected;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really need this out here; could have a constant return value and a more-local variable introduced for get_instance_status

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept it that way because the status could be "not connected" or "no data".. I would like the sensor to return the value that is true for a sensor, rather than an arbitrary constant

Copy link
Contributor

@rmackay9 rmackay9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the get_obstacle_count and get_object_count are removed we can merge, thanks!

@rmackay9
Copy link
Contributor

rmackay9 commented Mar 5, 2024

Thanks, added the MergeOnCIPass...

@tridge tridge merged commit d911475 into ArduPilot:master Mar 7, 2024
89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants