395 Commits

Author SHA1 Message Date
Daniel Agar
e7b7ccf68f
auto mission fly home before complete loss of global position estimate
- ekf2: expose dead reckoning as control status flags
 - commander:
    - add GPS validity check
    - in AUTO MISSION if dependent on GPS then a loss of GPS will
trigger RTL so that the plane can return home while dead reckoning
2021-12-28 11:10:24 -05:00
Beat Küng
8e04934eab commander: consider COM_MOT_TEST_EN for COMMAND_ACTUATOR_TEST as well 2021-12-24 20:06:13 -05:00
Daniel Agar
7d7d707db9 commander: add COM_HOME_EN parameter to enable/disable home position 2021-12-23 15:46:31 -05:00
Matthias Grob
f68ae39840 Commander: avoid RC actions during calibration 2021-12-22 09:08:23 -05:00
Thomas Debrunner
eb69f15d3a health-flags: Increase health flags to 64 bit bit field to support extended sys status mavlink message
Add SYS_STATUS flag for parachute
2021-12-14 09:41:12 -05:00
Daniel Agar
986cf288da
dataman: remove obsolete persistence and reset reason 2021-12-12 12:06:35 -05:00
Thomas Debrunner
8db7a6225b geo: Moved the map_projection_* functions and state into a self-contained C++ class 2021-12-06 14:30:14 +01:00
Julian Oes
a9b9362fea commander: handle system broadcast commands
This changes the command handling logic to accept commands which are
targeted at any system, signaled by target_system set to 0.
2021-12-01 20:17:35 -05:00
Matthias Grob
55dfbdc6a6 Commander: fix remaining flight time user messaging 2021-11-30 19:46:22 +01:00
Matthias Grob
c5fb68b7a1 Commander: force disabling the arm stick gesture when arm switch is in use 2021-11-25 07:56:35 +01:00
Matthias Grob
c522a8b15a Compute RTL time and react if lower than flight time
- Compute RTL time also during RTL
- Calculate correct altitude when finding destination
2021-11-24 14:10:24 +01:00
Matthias Grob
5489005e0b Commander: call battery_status_check on update instead of early return 2021-11-24 14:10:24 +01:00
Beat Küng
21699935e8 vehicle_command: add VEHICLE_CMD_ACTUATOR_TEST and VEHICLE_CMD_CONFIGURE_ACTUATOR 2021-11-23 12:40:22 -05:00
Matthias Grob
0153c870d2 Commander: make sure yaw airmode is not possible while arm gesture is enabled
It's unsafe to arm with the gesture when yaw airmode is enabled
because e.g. in Stabilized mode that results in a high yawrate setpoint
that the drone tries to follow even with zero thrust
because of the airmode.

It was handled before by checking the arm switch parameter because that
used to disable the stick arm gesture.
See 24dc316973a049e50d3e6760eddbf7250cb55d2e
2021-11-23 16:03:46 +01:00
Daniel Agar
577d926639 commander: improve angular velocity validity and message 2021-11-22 11:27:45 -05:00
Matthias Grob
f912ee2c8b Commander: send out parachute MAVLink command when kill switch engaged 2021-11-19 17:15:04 +01:00
Matthias Grob
3193b554ca Add optional preflight check for healthy MAVLink parachute system 2021-11-19 17:15:04 +01:00
Matthias Grob
43c529f294 Add MAVLink parachute system heartbeat detection 2021-11-19 17:15:04 +01:00
Matthias Grob
4c6621f6cf Commander: Allow arming a rover with the throttle stick in the middle 2021-11-19 10:10:32 +01:00
RomanBapst
439400f76e commander: don't ack gimbal commands
- this leads to an unnecessary amount of acks which can in turn overflow
the orb queue

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2021-11-13 11:59:28 -05:00
kevindsp
17ad7071c3 fix the quaternion normalization issue
Be course of the numerical computing error . The normalization of the quaternion can't always equal to 1 precisely. It could occasionally trigger the error"attitude estimate no longer valid". So enlarge the threshold to 1e-6f. That keeps it silence.
2021-11-12 16:31:40 +01:00
Matthias Grob
fabf865411 Use backwards compatible manual_control_setpoint instead of manual_control_input 2021-11-09 16:05:25 +01:00
Matthias Grob
7e4a079e09 Commander: report when RC selected mode is not available 2021-11-09 16:05:25 +01:00
Matthias Grob
a593a51f05 Commander: fix mode initialization with RC 2021-11-09 16:05:25 +01:00
Matthias Grob
38ab7e6ab9 Commander: separate function for action request execution 2021-11-09 16:05:25 +01:00
Matthias Grob
0a02d8e774 Commander: handle denying disarm when not landed centrally 2021-11-09 16:05:25 +01:00
Matthias Grob
dcd26bd2b8 Commander: fix "Manual control lost" showing double in QGC
because of the missing tab in the deprecated message.
2021-11-09 16:05:25 +01:00
Matthias Grob
956997eb1e Replace arm_request and mode_request with combined action_request
Which saves flash space, log size and is extensible to handle e.g.
the VTOL transition and future actions.
2021-11-09 16:05:25 +01:00
Matthias Grob
052e29267d Use mode_request for RC mode switching 2021-11-09 16:05:25 +01:00
Matthias Grob
f8e4846851 Use arm_request for manual killing 2021-11-09 16:05:25 +01:00
Matthias Grob
af607e3040 Use separate arm_request instead of vehicle_command for RC arming 2021-11-09 16:05:25 +01:00
Matthias Grob
7a2ef4a917 Commander: don't publish RC_IN_MODE to vehicle_status
This just contains the content of the parameter which
is redundant and results in multiple sources of truth.
2021-11-09 16:05:25 +01:00
Matthias Grob
4dc165efd0 Commander: don't retry to reach the desired_main_state if we reached it 2021-11-09 16:05:25 +01:00
Matthias Grob
d48302c841 Commander: send out manual control lost event 2021-11-09 16:05:25 +01:00
Matthias Grob
93bed7f670 vehicle_command: shorten arming action/origin enum names 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
53bd254502 commander: add valid check
Better checking once too much than once too little.
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
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
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
2e9edfcd89 commander: only override according to param
This got lost in the refactor earlier.
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
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
97aa06cc19 commander: move switch handling to manual_control 2021-11-09 16:05:25 +01:00