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

Rover: Perform an arm check first #27022

Closed

Conversation

muramura
Copy link
Contributor

@muramura muramura commented May 8, 2024

Performing an arm check first ensures that the fence check does not become unnecessary.

const uint8_t orig_breaches = fence.get_breaches();

// check for a breach
uint8_t new_breaches = fence.check();
Copy link
Member

@IamPete1 IamPete1 May 8, 2024

Choose a reason for hiding this comment

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

Think this is the main "update" function for fence. So even thought the return is not used we still need to call it. Otherwise the fence arming check might not work for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A fence_check is performed in the arming.pre_arm_checks method.

https://github.com/ArduPilot/ardupilot/blob/master/Rover/Rover.cpp#L450

Copy link
Member

Choose a reason for hiding this comment

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

Right, but it does not actually check if the vehicle is inside the fence, it just uses the result of the last check. Except there now will be no result because your not running the check.

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 understood.

Copy link
Member

@IamPete1 IamPete1 left a comment

Choose a reason for hiding this comment

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

This is failing CI because it not correct.

2024-05-08T19:37:04.4497292Z Failure Summary:
2024-05-08T19:37:04.4497637Z   test.Rover:
2024-05-08T19:37:04.4498793Z     PolyFence (test fence-related functions) (Expected to be breached) (see /tmp/buildlogs/Rover-PolyFence.txt) (duration 3.3232529163360596 s)
2024-05-08T19:37:04.4500007Z FAILED 1 tests: ['test.Rover']

It would be much clearer if the fence check method was void and called update. Then a second call to get_breaches to check for new breaches.

@IamPete1 IamPete1 closed this May 9, 2024
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.

2 participants