-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
Add AP_INVERTED_FLIGHT_ENABLED #24332
base: master
Are you sure you want to change the base?
Changes from all commits
3f2e600
e0d1713
759b8af
10c8cc0
91ea452
a33c31c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
#include <AP_Param/AP_Param.h> | ||
#include <AP_Math/AP_Math.h> | ||
#include <AP_Common/Bitmask.h> | ||
#include <AP_HAL/AP_HAL_Boards.h> | ||
|
||
#define NUM_RC_CHANNELS 16 | ||
|
||
|
@@ -144,7 +145,9 @@ class RC_Channel { | |
AVOID_PROXIMITY = 40, // enable object avoidance using proximity sensors (ie. horizontal lidar) | ||
ARMDISARM_UNUSED = 41, // UNUSED | ||
SMART_RTL = 42, // change to SmartRTL flight mode | ||
#if AP_INVERTED_FLIGHT_ENABLED | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the first example of using a define to remove something from the enum. This would start a new pattern. I do think it is a good idea. The "KILL_IMU" option would be a good candidate too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True. However, we do it a lot in other enumerations, and I'd put down a little bit of money we'll find at least one thing that's Not Quite when we gate them. |
||
INVERTED = 43, // enable inverted flight | ||
#endif | ||
WINCH_ENABLE = 44, // winch enable/disable | ||
WINCH_CONTROL = 45, // winch control | ||
RC_OVERRIDE_ENABLE = 46, // enable RC Override | ||
|
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 would prefer to pull out either the sign or the fly inverted bool and keep just one line of the constrain. I think the maths is easier to understand if there is only one copy.
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.
Maybe we could take the opportunity to break it up a little.
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.
Yep, I did that, and random other changes like it.
And reverted those changes, because I really like to keep these add-defines things as completely no compiler output change in the case that you have not turned the option on. It means that no existing user will ever run into problems with the code.
I've achieved that with this PR now, and updated the blocks in the opening comment appropriately.
It does uglify the code a bit, but I do plan on going back to the places and cleaning it up by factoring bits and pieces. Especially the bit in takeoff.cpp. The block that patch is in will make for a nice new method with earl returns etc, something like:
I think that's the same logic, but I'm not convinced it's good logic.... e.g. should those pitch limits be the other way around if you're inverted? Why aren't we checking roll when inverted?
Give I think we now have a partner who flies this way, we should probably give it more serious consideration now, and I think this would make for a good separate PR...
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've created a patch on top of this over here which shows things prettied up a bit:
https://github.com/ArduPilot/ardupilot/compare/master...peterbarker:ardupilot:pr/inverted-flight-tidy?expand=1