Commit Graph

38682 Commits

Author SHA1 Message Date
Matthias Grob 93bed7f670 vehicle_command: shorten arming action/origin enum names 2021-11-09 16:05:25 +01:00
Matthias Grob 709c909929 commander_params: correct RC override description 2021-11-09 16:05:25 +01:00
Julian Oes b3a5072de5 commander/manual_control: use msg enum for params
Instead of using a private enum class we should define the enum in the
vehicle_command message and then use it consistently.
2021-11-09 16:05:25 +01:00
Julian Oes f1b1068824 commander: remove unused mode/main_state methods
With the previous changes these seem no longer required.
2021-11-09 16:05:25 +01:00
Julian Oes 42af44700b mc_rate_control: always allow landing gear control
Except of course when landed and we try to put it up.
2021-11-09 16:05:25 +01:00
Julian Oes 486a4b0118 mavlink: reduce calls to hrt_absolute_time 2021-11-09 16:05:25 +01:00
Julian Oes 454aa611ae manual_control: add missing 7 2021-11-09 16:05:25 +01:00
Julian Oes 2c0fc686a7 manual_control: don't accept outdated input 2021-11-09 16:05:25 +01:00
Julian Oes 4d00a56230 manual_control: method can be static 2021-11-09 16:05:25 +01:00
Julian Oes 6027398459 manual_control: handle invalid rc_in_mode 2021-11-09 16:05:25 +01:00
Julian Oes 50cca204d8 manual_control: add check for instance 2021-11-09 16:05:25 +01:00
Julian Oes 963d15eacc manual_control: use correct sysid/compid 2021-11-09 16:05:25 +01:00
Julian Oes cfdb53a4d8 manual_control: don't switch gear on first init
This will ignore the first transition from NONE to something.
This matches the behaviour that existed before.
2021-11-09 16:05:25 +01:00
Julian Oes 60de330f18 manual_control: add hysteresis for arm button back 2021-11-09 16:05:25 +01:00
Julian Oes 75209a7552 manual_control: address review comments 2021-11-09 16:05:25 +01:00
Matthias Grob 942eb23248 ManualControlSelector: remove commented stick difference filter draft 2021-11-09 16:05:25 +01:00
Matthias Grob 11a46d3d27 ManualControlSelectorTest: add constantly outdated samples case
Reviewing the code I saw this case arising from the order things
get checked.
2021-11-09 16:05:25 +01:00
Julian Oes 39282a795f manual_control: fix tests 2021-11-09 16:05:25 +01:00
Julian Oes 53bd254502 commander: add valid check
Better checking once too much than once too little.
2021-11-09 16:05:25 +01:00
Julian Oes efd8757fda manual_control: handle NAN 2021-11-09 16:05:25 +01:00
Julian Oes 374c9f38a7 manual_control: use constrain() instead 2021-11-09 16:05:25 +01:00
Julian Oes 2a41ade223 manual_control: update first, get diff after
Not sure why I had this the wrong way round.
2021-11-09 16:05:25 +01:00
Julian Oes d0fea93d72 manual_control: add reset to diff
This should prevent triggering user override right after RC re-appears.
2021-11-09 16:05:25 +01:00
Julian Oes 93c505b163 commander: force arming is not an option from RC 2021-11-09 16:05:25 +01:00
Julian Oes 4a5ef1c81e ROMFS: whitespace 2021-11-09 16:05:25 +01:00
Julian Oes 6a6b8d49fc msg: re-use manual_control_input in setpoint
This way we avoid duplication between manual_control_input and
manual_control_setpoint.
2021-11-09 16:05:25 +01:00
Julian Oes baf81abbab msg: whitespace only 2021-11-09 16:05:25 +01:00
Julian Oes 14cfad74bf manual_control: remove leftover debug statements 2021-11-09 16:05:25 +01:00
Julian Oes 5ae76bdc17 commander: fix potentially wrong user message 2021-11-09 16:05:25 +01:00
Julian Oes bd0c1014d9 manual_control: support arming button
The arming button required some refactoring in order to support to
toggle arm/disarm using the vehicle_command. Otherwise manual_control
would have to subscribe to the arming topic and we would spread out the
logic again, and risk race conditions.
2021-11-09 16:05:25 +01:00
Julian Oes 9cbfa2ca95 manual_control: ORBIT and PRECLAND not supported
ORBIT and PRECLAND are not actually possible on the flight mode switch.
2021-11-09 16:05:25 +01:00
Julian Oes 2e9edfcd89 commander: only override according to param
This got lost in the refactor earlier.
2021-11-09 16:05:25 +01:00
Julian Oes 56b2b81600 manual_control: use filter to check user override
Instead of only looking at the diff between two RC samples to decide
whether a user wants to override, we now look at the filtered diff over
one second. This should be more robust to RC sent at various or varying
rates.
2021-11-09 16:05:25 +01:00
Julian Oes 97d01f200e commander: move manual_control and switches out
This moves the remaining handling of the manual control stuff out
of commander. All communication between manual control now goes through
vehicle commands, and the landing gear topic.
2021-11-09 16:05:25 +01:00
Julian Oes e49b596edc commander: add desired main state
This is an intermediate solution to carry forward the initial state of
the mode slot. Basically, it allows that we start up in Stabilized but
switch to POSCTL as soon we have the required GPS.
2021-11-09 16:05:25 +01:00
Julian Oes b6af068f25 commander: always reset posvel validity
I assume reseting posvel validity is ok for any case, not just all cases
except manual, acro, stabilized.
2021-11-09 16:05:25 +01:00
Julian Oes 52563264e6 commander: move valid mission check inside
I think it makes more sense to move this check inside of
main_state_transition.
2021-11-09 16:05:25 +01:00
Julian Oes 916ffef04c manual_control: send initial mode in the beginning
In order for commander to know the desired mode we need to send the
initial position of the mode slot.
2021-11-09 16:05:25 +01:00
Julian Oes a91fa7f3c1 commander: only move to POSCTL when armed
I don't think we want to switch to POSCTL when the sticks are moved when
armed.
2021-11-09 16:05:25 +01:00
Julian Oes 66b069e788 commander: move main_state_transition out
This is a first step to having a desired main state.
2021-11-09 16:05:25 +01:00
Julian Oes e2e908d0fc mavlink: remove unused methods 2021-11-09 16:05:25 +01:00
Julian Oes 97aa06cc19 commander: move switch handling to manual_control 2021-11-09 16:05:25 +01:00
Julian Oes 08e58a44e9 Fix style 2021-11-09 16:05:25 +01:00
Julian Oes 71d6aa913d manual_control: starting to implement switches 2021-11-09 16:05:25 +01:00
Julian Oes ac121c676a commander: check for valid flag for manual_control 2021-11-09 16:05:25 +01:00
Julian Oes cda6524421 manual_control: move override detection
This also removes the option to ignore throttle for the override
detection as it's not really required anymore.
2021-11-09 16:05:25 +01:00
Julian Oes 1c15cc11d8 manual_control: implement (dis)arming via command 2021-11-09 16:05:25 +01:00
Julian Oes 8876af9150 manual_control: add instance to selector
This instance is then used to schedule the callback for the
subscription.
2021-11-09 16:05:25 +01:00
Julian Oes 14eb656a59 rc_update: use snake_case for namespace name 2021-11-09 16:05:25 +01:00
Julian Oes 6e8ccf6a45 rc_update: rename update method
This reflects better what it actually does.
2021-11-09 16:05:25 +01:00