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

Copter: check for fence breaches when disarmed #8264

Merged
merged 1 commit into from
Jun 11, 2018

Conversation

chobitsfan
Copy link
Contributor

@chobitsfan chobitsfan commented Apr 30, 2018

It fix the problem that copters keep showing "invalid Fence Boundaries", even user have upload a valid polygon fence. This problem makes copters can not use polygon fence

#7411 add a pre-arm check for polygon fence validity. But in copter, polygon fence is not loaded before armed and leave _boundary_valid false. Which cause polygon fence per-arm check fail and make copter can not be armed. It create deadlock and makes copter unable to use polygon fence

Copy link
Member

@OXINARF OXINARF left a comment

Choose a reason for hiding this comment

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

I think this isn't the correct way to deal with it. I think we should change

// ignore any fence activity when not armed
if(!motors->armed()) {
return;
}

to be after

// check for new breaches; new_breaches is bitmask of fence types breached
const uint8_t new_breaches = fence.check();

So that we still don't do anything when disarmed, but we do check for fence breaches.
Main reason is that the fence pre-arm check actually checks if any fence has been breached - that's not ever going to be true if we don't call check on AP_Fence while disarmed.

@peterbarker
Copy link
Contributor

I have a feeling this stuff might be the cause of a weird behaviour you get on Copter sometimes where a vehicle arms, failsafes and instantly disarms, but you can then rearm no problems and the vehicle remains armed.

Again, no hard data, but it's possible @OXINARF 's suggestion might fix that problem.

@chobitsfan chobitsfan changed the title AC_Fence: load polygon fence for pre-arm check Copter: load polygon fence when disarmed for validity check May 8, 2018
@chobitsfan
Copy link
Contributor Author

OK, I have tested @OXINARF 's changes on both SITL and my quadcopter. It looks good. Thank you very much

@OXINARF
Copy link
Member

OXINARF commented May 8, 2018

@chobitsfan Great! Can you just change the commit message? Something like Copter: check for fence breaches when disarmed better describes what it does.

@chobitsfan chobitsfan changed the title Copter: load polygon fence when disarmed for validity check Copter: check for fence breaches when disarmed May 8, 2018
// we still don't do anything when disarmed, but we do check for fence breaches.
// fence pre-arm check actually checks if any fence has been breached
// that's not ever going to be true if we don't call check on AP_Fence while disarmed.
if(!motors->armed()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick : miss a space !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@rmackay9 rmackay9 merged commit 75c2a2b into ArduPilot:master Jun 11, 2018
@rmackay9
Copy link
Contributor

Merged, thanks very much! This will be included in Copter-3.6.0-rc3!

@rmackay9 rmackay9 moved this from PRs to 3.6.0-rc3 in Copter 3.6 Backports Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Copter 3.6 Backports
  
3.6.0-rc3/-rc4
Development

Successfully merging this pull request may close these issues.

None yet

6 participants