-
Notifications
You must be signed in to change notification settings - Fork 16.8k
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
Conversation
fe109cc
to
28cb638
Compare
There was a problem hiding this 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
ardupilot/ArduCopter/fence.cpp
Lines 11 to 14 in 8108931
// ignore any fence activity when not armed | |
if(!motors->armed()) { | |
return; | |
} |
to be after
ardupilot/ArduCopter/fence.cpp
Lines 18 to 19 in 8108931
// 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.
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. |
28cb638
to
18e35f2
Compare
OK, I have tested @OXINARF 's changes on both SITL and my quadcopter. It looks good. Thank you very much |
@chobitsfan Great! Can you just change the commit message? Something like |
18e35f2
to
4418355
Compare
ArduCopter/fence.cpp
Outdated
// 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()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick : miss a space !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
4418355
to
ced830a
Compare
Merged, thanks very much! This will be included in Copter-3.6.0-rc3! |
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