-
Notifications
You must be signed in to change notification settings - Fork 19.9k
Avoid setting AP_FENCE_ENABLED to 2 #31716
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
base: master
Are you sure you want to change the base?
Conversation
ab00c26 to
939d3e7
Compare
peterbarker
left a comment
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 you're missing the points of that == 2 thing.
------ ----- ---------- ------ ---- ----- ----- ---
Board blimp bootloader copter heli plane rover sub
CUAVv5 2632 * * * * * *
------ ----- ---------- ------ ---- ----- ----- ---
pbarker@crun:~/rc/ardupilot((HEAD detached at 939d3e7ce4d))$
tracker would also get the same size bigger.
As mentioned elsewhere, I think you could propose removing the == 2 stuff (and the dummy methods) entirely and it would get up as a PR.
939d3e7 to
b70af63
Compare
|
@peterbarker The |
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
peterbarker
left a comment
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 like this. But I think we should also look at just eliminating the dummy method stuff entirely for Fence!
2cc759b to
0f94efe
Compare
peterbarker
left a comment
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, I think we need one more patch in here. If a user currently has AC_FENCE_ENABLED set to 2 then we should throw a #error.
Should also ping @IamPete1 as he put this stuff in.
Again, I'm thinking we can live with Blimp and Tracker having fence simply on by default. But that step is easier past this PR anyway as we just remove anything to do with the dummy methods.
0f94efe to
978b844
Compare
This decouples the AP_FENCE_ENABLED and AC_FENCE_DUMMY_METHODS_ENABLED defines and restricts AP_FENCE_ENABLED to be set to 2.
978b844 to
b5007d7
Compare
|
|
||
| void AC_PolyFence_loader::update() {}; | ||
|
|
||
| #if AC_POLYFENCE_FENCE_POINT_PROTOCOL_SUPPORT |
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 is going because:-
- we do not wrap the call to this method with this define.
- the non-dummy implementation for this method is also not wrapped under this define
No compiler output change for the changes included in this PR. |
|
We did originally start this pattern for the build server. The ides was that 0 would remove the feature, and 1 would enable it. 2 would then be the correct default for the vehicle type. I have no problem with this here in Fence because no one would ever need fence on tracker or blimp. However, we use the same pattern for AIS and Temperature sensor. Its perfectly reasonable to want AIS outside of rover, and it will still work correctly for reporting. How would the build server handle this going forward? |
Currently, we suggest that AC_FENCE_ENABLED can be set to 0, 1 or 2, which is against the pattern followed throughout the codebase. In the
AP_*_ENABLEDworld, something should either be ENABLED or DISABLED, nothing in between.Setting AC_FENCE_ENABLED to 2 just brings only one additional change in behavior compared to setting it to 1, which is - it compiles code with some dummy methods in AC_Fence for tracker/blimp.
We already have AC_FENCE_DUMMY_METHODS_ENABLED for that and a user wanting to enable/disable dummy methods, should do so by directly setting AC_FENCE_DUMMY_METHODS_ENABLED, NOT by setting AC_FENCE_ENABLED to 2 (and relying on that to set AC_FENCE_DUMMY_METHODS_ENABLED to 1 in turn).
I caught this while working on a Custom Build Server enhancement and this really breaks things there.