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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions Rover/fence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
void Rover::fence_check()
{
#if AP_FENCE_ENABLED
uint8_t new_breaches; // the type of fence that has been breached
const uint8_t orig_breaches = fence.get_breaches();

// check for a breach
new_breaches = fence.check();

// return immediately if motors are not armed
if (!arming.is_armed()) {
return;
}

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.


// if there is a new breach take action
if (new_breaches) {
// if the user wants some kind of response and motors are armed
Expand Down
Loading