-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Commander: start pulling arming related parts into separate folder #13224
Conversation
9a7db27
to
27c7782
Compare
That is a revolution |
@ndepal Definitely related. Thanks for referencing. I can rebase either way no matter which one goes first. |
2c64c0d
to
53f7fa7
Compare
Glad to see some movement here! One thing I'd like to get sorted out is the line between preflight, prearm, and checks that can run continuously. I'm wondering if we can get to the point where nearly everything results in status flags and have the arming machine act on that data rather than actually executing the checks. The other missing piece is fitting this into mavlink. |
} | ||
|
||
/* ---- BARO ---- */ | ||
if (checkSensors) { |
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.
Perhaps not what you want to tackle here, but I'm wondering if all this sensors code should be owned by the sensors module. Then a higher level sensors status would be published for commander to act on.
@dagar Thanks for looking over it and your input! I try to share as many thoughts as possible. I want to first get it all in a less interdependent and hence more maintainable adaptable state.
My intentions after talking to a bunch of people about this: Preflight checks are the ones that determine if you can fly or not (user-focused), the pre arm checks (I left the name for now but it might not make sense anymore) are just one kind of preflight check since they prevent arming and hence flying.
Exactly the intention and why I started refactoring this. The goal is that there is no check that was not done before giving an arm command/input, no surprises to the user anymore. The arming state machine itself just knows if there's green light.
I agree, first I have to leave the strings but have them all optional (to not spam), then I plan to fill the flags at the beginning of https://mavlink.io/en/messages/common.html#SYS_STATUS as in-between solution and eventually we'll have the events interface taking care of delivering the status to the UI.
I thought exactly the same let's go in steps. My currently intended steps:
This PR should only do the first point otherwise it gets too big of a change. |
c25c6ba
to
3ef2a84
Compare
@dagar @bresch I rebased on master with the only relatively trivial conflict of these lines: It would be nice to get this in soon. I can rebase other conflicting prs easily. |
src/modules/commander/Arming/PreFlightCheck/checks/CMakeLists.txt
Outdated
Show resolved
Hide resolved
3ef2a84
to
558d3bb
Compare
558d3bb
to
148b52b
Compare
I'm assuming CI problems are now unrelated. It's ready for review check. |
Looks good to me. Can you rebase? |
148b52b
to
856bca2
Compare
Rebased |
to overview dependencies and simplify editing. All checks together are >1200 lines!
856bca2
to
fbaee76
Compare
Upon request of @dagar I did a quick test on a real vehicle with a pixhawk 4 mini. I can normally arm and fly when all checks pass. When the vehicle is upside down I can't arm because of the failing roll check. |
Describe problem solved by this pull request
Goal: The user knows in advance if he'll be able to arm.
Describe your solution
First step: Pull things that relate to arming logic into the folder Arming and make sure to have a clear interface for all checks that happen before arming can take place
Describe possible alternatives
Hack my way through commander trying to run important bits and pieces in a random and unmaintainable way.
Test data / coverage
Only draft yet but I'm constantly testing every single step by using the existing unit-sitl tests and my own sitl testing. Hopefully I try to get to the point where efficient gtest unit testing is possible.
Additional Context
#7055