-
Notifications
You must be signed in to change notification settings - Fork 16.9k
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
ArduPlane: add AC_Fence for QGC4.0 Geofence Support #15288
Conversation
128b930
to
f90ee6f
Compare
40d8deb
to
4314765
Compare
Some tasks that remain outstanding: |
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.
Started to review here, but retaining the existing geofence code is confusing the issue.
Why retain the existing geofence implementation? We don't carry dead code, so.... Also, it seems to be half-and-half with retaining geofence functionality.
Oh, also, alt_min may be <-100 for Subs :-) |
.... also, please squash your commits up into logical changes. There are patches in here which are definitely "fixups" of previous commits. I do realise this is WIP :-) |
Fair call - the intention was more for the review process and an ability to swap between the two versions, or for those that want to maintain their existing
Good call - still trying to piece together how the documentation/param parsing works.
Apologies, I've tried to nail everything on my first PR, but things were bound to get missed. Certainly can do that. |
The fence min-alt stuff.... floor seems a little tacked-on ATM. Should we consider making (I actually have a related PR which would make that |
As tacked-on as it is, keep in mind that it was the goal to change the minimum amount of
Certainly steering away from |
Commits logically squashed for adding of |
7ce4f59
to
c7e2d35
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.
This makes one of my PR's ( #7111 ) to add a floor fence to copter mostly obsolete.
One think I have in mine though is that it uses the down-facing lidar, if present, for the floor fence calculations.
libraries/AC_Fence/AC_Fence.cpp
Outdated
// @Values: 0:Report Only,1:RTL or Land | ||
// @User: Standard | ||
AP_GROUPINFO("ACTION", 2, AC_Fence, _action, AC_FENCE_ACTION_RTL_AND_LAND), | ||
|
||
// @Param{Copter, Sub}: ALT_MAX | ||
// @Param: ALT_MAX |
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.
Rover also probably will not want this
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.
Is there a use case where Rover may be climbing a mountain-side and exceed an altitude that needs to RTL?
I do note that it was not in the AP_GROUPINFO_FRAME
definition, but, safest to check.
c7e2d35
to
c81cc74
Compare
Thanks @amilcarlucas - I'll take a look at your implementation. Perhaps this could be a two part process where the down-facing lidar is added as a follow-up? |
Yes that would be great |
Some of the CI builds are failing, can you look into that? |
Ahh, rebased but missed one last commit to finish removing geofence code. Using the |
c81cc74
to
fbd163f
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.
PR is incorrect; this will appear in Plane 4.1
FENCE_CHANNEL
should be migrated to use the existing RC_Option. This could be done ahead of time as a distinct PR - there's parameter conversion involved, so it's non-trivial
autotests:
- ensure we can auto-enable the fence when vehicle armed
- should disallow arming if we are outside the fence when we auto-enable
- need tests around MAV_CMD_DO_FENCE_ENABLE
- minimum altitude fence breach
- fence_ret_rall works
- need tests for what happens when fences are disabled while we're breached and undertaking an action
This PR is absolutely fantastic. So many red lines!
// clear alt breach if present | ||
if ((_breached_fences & AC_FENCE_TYPE_ALT_MIN) != 0) { | ||
clear_breach(AC_FENCE_TYPE_ALT_MIN); | ||
_alt_min_backup = 0.0f; |
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.
Do we need to zero these?
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.
Implementation for check_fence_alt_min
is a reworked check_fence_alt_max
, which contains this same assignment. I'd have to confirm the conditions in which the backup fence is used.
I suspect if we dont, the following series may occur:
- Flying within fences.
- Breach floor. Set backup floor
- Breach backup floor. Set new backup floor (repeat
n
times) - Return inside fence
- Breach
FENCE_ALT_MIN
,(!is_zero(_alt_min_backup) && _curr_alt < _alt_min_backup)
is treated as an old breach, because our current alt is less thanALT_MIN
but greater than thealt_min_backup
.
On Thu, 10 Sep 2020, James O wrote:
On a dev call it was mentioned there was a script that performs these checks? My google-fu is weak today, apparently.
Yes, we have an auto-formatter. But it won't just check your delta, it
will do the entire file, which is kind of bad as you'll end up with lots
of unrelated meaningless changes making review a chore.
It's ./Tools/CodeStyle/ardupilot-astyle.sh
|
Thanks for the pointer to the script. I'll take a look and see if it helps at all. Could be more hassle than it's worth, but good for use in the future. |
fbd163f
to
53da425
Compare
According to: http://www.ardusub.com/developers/full-parameter-list.html Edit: Thinking about it... I'm adding in the floor support in this PR - I assume sub never had floor support in the first place!
|
53da425
to
d349657
Compare
|
Addresses comments made in review, removes the FENCE_AUTOENABLE param for copter. No param means no tests required.
These issues have been addressed. I can't seem to find where your comment went, but it also addresses the issue of re-triggering a fence breach when jumping out of the Also, made |
… disabled while under action
I've now also added an autotest to ensure mode change outside of the fence re-triggers the fence action (as per discovered during testing). Also added an autotest to capture, and ensure the correctness of the overflow found in |
2bece87
to
a31705a
Compare
…ched AutoTest: Adds test for fence breach switching to guided mode when no fence return point is present. In upstream, this results in a vehicle fly-away.
a31705a
to
44d4033
Compare
@amilcarlucas comments added to |
We should probably make sure that fence behaviour is unchanged when we lose our GPS (and other absolute positioning) sources. This can be tested in SITL using |
This review is rather stale at this point. There are changes to Plane's behavior in the case of GPS loss in the current PR, but they do appear to be for the best.
Many Thanks and Congrats to @joshanne . Great work! |
PR based on #13700 - see further discussion there
Geofence
toAC_Fence
for Fence support in QGC.geofence
capability has been dropped in favour ofAC_Fence
. Some assumptions have been made.AC_Fence
geofence
work, mostly untouched.Requires:
Todo: