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

SITL: avoid floating point exception around rangefinder distance #28368

Merged

Conversation

peterbarker
Copy link
Contributor

projecting onto an infinite plane can cause exceptionally long rangefinder distances - for now jsut cap the distance that the simulated rangefinder can return to avoid floating point exceptions.

the FPE is caused in the Plane FlyEachFrame autotest when flying quadplane-copter_tailsitter - which ends up with a rangefinder at yaw-minus-180.

This is the FPE:
image

projecting onto an infinite plane can cause exceptionally long rangefinder distances - for now jsut cap the distance that the simulated rangefinder can return to avoid floating point exceptions.

the FPE is caused in the Plane FlyEachFrame autotest when flying quadplane-copter_tailsitter - which ends up with a rangefinder at yaw-minus-180.
@peterbarker peterbarker merged commit b36f539 into ArduPilot:master Oct 10, 2024
98 checks passed
@peterbarker peterbarker deleted the pr/fix-fpe-problem-rangefinder branch October 10, 2024 22:35
@@ -1058,6 +1067,9 @@ void Aircraft::update_external_payload(const struct sitl_input &input)

{
const float range = rangefinder_range();
if (!isinf(range) && range > 100000) {
AP_HAL::panic("Bad rangefinder calculation");
Copy link
Contributor

@muramura muramura Oct 10, 2024

Choose a reason for hiding this comment

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

What happens if a PANIC occurs during flight?
I think it's unacceptable if it becomes uncontrollable.

Copy link
Contributor

Choose a reason for hiding this comment

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

that is SITL, panic will just block the simulation to allow to catch the bug

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.

3 participants