Commit Graph

348 Commits

Author SHA1 Message Date
David
020215f146 commander: don't allow arming during VTOL transition 2019-12-17 12:21:11 -08:00
Daniel Agar
a2bd65460d commander: add vehicle-status nav_state change timestamp 2019-11-19 10:24:52 -05:00
Matthias Grob
1a79f75f94 Commander: start pulling arming related parts into separate folder
* PreFlightCheck: remove unused reportFailures flag
* Commander: pull all pre flight checks together on the PreFlightCheck class
* PreFlightCheck: separate checks into their own files
2019-11-05 11:25:59 -05:00
Julian Oes
4ff4f5c77f commander: fix capitalization of mavlink messages 2019-11-05 10:40:30 +01:00
Julian Oes
24c58db9e6 commander: fix battery failsafe without GPS
This fixes the battery failsafe for the following corner cases:
- Battery failsafe set to Return but we can't do RTL because we don't
  have a global position or home position. In this case we now switch to
  Land. Land might end up in Descend in the failsafe state machine
  later.
- Battery failsafe set to Land but we can't land because we don't have a
  local position. In this case we switch to land anyway and then fall
  back to descend in the failsafe state machine later.

The "fix" involves ignoring using the main_state_transition and
implementing the guards in place. This is a hack for now but should
cover the corner case until a more thorough refactor.

The different failsafe state machines have involved over time from
requirements and learnings based on developed solutions and products.
The implementations in various places will need to get consolidated in
the future.

Tested in SITL for Return and Land with and without GPS.
2019-11-05 10:40:30 +01:00
Beat Küng
3198610f85 src/platforms: move all headers to platforms/common/include/px4_platform_common
and remove the px4_ prefix, except for px4_config.h.

command to update includes:
for k in app.h atomic.h cli.h console_buffer.h defines.h getopt.h i2c.h init.h log.h micro_hal.h module.h module_params.h param.h param_macros.h posix.h sem.h sem.hpp shmem.h shutdown.h tasks.h time.h workqueue.h; do for i in $(grep -rl 'include <px4_'$k src platforms boards); do sed -i 's/#include <px4_'$k'/#include <px4_platform_common\/'$k/ $i; done; done
for in $(grep -rl 'include <px4_config.h' src platforms boards); do sed -i 's/#include <px4_config.h/#include <px4_platform_common\/px4_config.h'/ $i; done

Transitional headers for submodules are added (px4_{defines,log,time}.h)
2019-10-30 11:48:47 +01:00
RomanBapst
6bfb50df8a run arm authorization as last pre-arm check, as it used to be implemented
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-10-15 15:44:24 +01:00
Julien Lecoeur
85c2e7d65d Offboard failsafe actions: cleanup and move to dedicated functions 2019-08-21 07:56:20 -07:00
Julien Lecoeur
4c9288d993 Commander: cleanup COM_POSCTL_NAVL parameter
- move to px4::params
- use enum
2019-08-21 07:56:20 -07:00
Beat Küng
b8dba34fd0 commander arming_state_transition: do not call prearm_check if !fRunPreArmChecks
Reason: if you don't want preflight checks, you don't want prearm checks
either (these are the circuit breakers, like usb connected check).

The other changes are cleanup and rework of operations.

In most cases, arming_state_transition is called with fRunPreArmChecks set
to true, so no change in behavior.

The cases with fRunPreArmChecks=false are:
- unit tests
- in_arming_grace_period=true (quick arming after disarm)
- VEHICLE_CMD_PREFLIGHT_CALIBRATION (does not transition to armed)
2019-08-19 10:54:56 +02:00
Mathieu Bresciani
dab66e92d3 Fix typo 2019-08-15 14:31:23 +02:00
Dennis Mannhart
bf25c462b2 Orbit failsafe: switch internal_state to Posctrl such that Manual-Positionctrl is activated after failsafe recovery. This is needed because Orbit can only be invoked via vehicle_command msg. 2019-08-15 14:31:23 +02:00
Claudio Micheli
187a025dfe Commander: added esc_status prearm checks
Signed-off-by: Claudio Micheli <claudio@auterion.com>
2019-08-09 09:41:17 +02:00
Andrei Korigodski
5133453822 vehicle_status: replace ARMING_STATE_REBOOT with ARMING_STATE_SHUTDOWN
Signed-off-by: Andrei Korigodski <akorigod@gmail.com>
2019-08-05 05:55:33 -07:00
alessandro
2deab6c607 commander: refactored state-machine strings
- Follow-up changes to https://github.com/PX4/Firmware/pull/11796
2019-06-17 20:09:05 +02:00
Timothy Scott
21760a5856 Changed constant name to UNMANNED_GROUND_VEHICLE 2019-06-13 10:04:26 +02:00
Timothy Scott
a134da6e12 Removed is_rotor_wing, replaced with vehicle_type 2019-06-13 10:04:26 +02:00
Claudio Micheli
f4a4dab65a Commander: Improved logic for OA prearm checks.
Signed-off-by: Claudio Micheli <claudio@auterion.com>
2019-03-27 09:56:32 +01:00
Claudio Micheli
107746ded5 Added obstacle avoidance healthiness topic in vehicle status msg.
This allows to perform pre-arm checks and prevent arming if obstacle avoidance is enabled but not yet running.
Added a print once flag to prevent excessive message spamming in QGC.

Signed-off-by: Claudio Micheli <claudio@auterion.com>
2019-03-27 09:56:32 +01:00
Claudio Micheli
13f3ee4c82 state_machine_helper: (Critical) Prevent datalink failsafe triggering if not enabled.
Signed-off-by: Claudio Micheli <claudio@auterion.com>
2019-03-12 11:24:33 +01:00
Daniel Agar
6dec451bab HEARTBEAT and commander failsafe handling cleanup 2019-03-12 11:24:33 +01:00
Matthias Grob
e979d24fff commander: fix orbit failsafes for data link & rc loss 2018-12-08 22:34:57 +01:00
Matthias Grob
34fb52d8bd commander: add orbit state handling 2018-12-08 22:34:57 +01:00
Daniel Agar
48d9484ceb commander fix and enforce code style 2018-11-28 20:42:03 -05:00
CarlOlsson
db4d79358a commander: fix typo 2018-10-22 09:26:06 -04:00
Julian Oes
d370a7c2b5 commander: remove unused HITL transition function
To my knowledge this hil transition function is not used anymore,
however, it makes sending the DO_SET_MODE command unnecessarily complex.
In my opinion the DO_SET_MODE command should only change the mode but
not other things like arming (already removed) and HITL state (this
commit).

Often times, I was seeing the error message "Set SYS_HITL to 1 and
reboot to enable HITL." when using QGC with a vehicle in HITL.

HITL is set via parameter which then has an impact in the startup script
where the CLI argument `-hil` is added to some of the commands that
require it (like commander as well).
2018-08-30 09:16:02 +02:00
Daniel Agar
29082d0118 commander battery_failsafe state machine share strings 2018-08-21 02:38:51 -04:00
Daniel Agar
6396e486bd commander cleanup battery failsafe handling 2018-08-21 02:38:51 -04:00
Beat Küng
8c3cf0167c commander arming_state_transition: respect fRunPreArmChecks properly
if fRunPreArmChecks was set to false, there were still cases where the
preflight checks could be called. This fixes that.

arming_state_transition() with fRunPreArmChecks=false is only called
when entering & leaving preflight calibration mode.
All other places use fRunPreArmChecks=true, which means there is no change
for these.
2018-06-27 10:41:21 +02:00
Daniel Agar
daa6f29b58 commander ignore failsafe transitions when in mission and disarmed 2018-06-13 08:37:00 +02:00
Daniel Agar
64fb4b43b6 commander preflightCheck don't report failures during calibration 2018-04-16 20:43:33 -04:00
Daniel Agar
2271b3f127 commander preflight checks pass status and status_flags messages 2018-04-16 20:43:33 -04:00
Daniel Agar
f2104217d4 commander arm_auth check last 2018-04-16 20:43:33 -04:00
Daniel Agar
a2bc0bd947 commander prearm_check limit simultaneous error messages 2018-04-16 20:43:33 -04:00
Daniel Agar
55596fad20 commander move safety check to prearm 2018-04-16 20:43:33 -04:00
Daniel Agar
a4703c6be4 commander arming state transition consolidate HIL special checks and remove atomic 2018-04-16 20:43:33 -04:00
Daniel Agar
54ea78898c commander arming state transition delete useless errors 2018-04-16 20:43:33 -04:00
Daniel Agar
1400652724 commander arming state machine pass checks by default
- this is needed for the unit tests
2018-04-16 20:43:33 -04:00
Daniel Agar
f81a1aedcd commander state machine add global position check 2018-04-16 20:43:33 -04:00
Daniel Agar
729c98d9e2 commander move avionics rail voltage check out of state machine
- add preflight_check helper
2018-04-16 20:43:33 -04:00
Daniel Agar
415c5f13bb commander move power check to prearm_check 2018-04-16 20:43:33 -04:00
Daniel Agar
c679703da4 commander move arm authorization to prearm_check 2018-04-16 20:43:33 -04:00
Daniel Agar
082126610d commander status flags delete condition_system_prearm_error_reported
- this flag often results in hiding useful information, or adding
   useless information to the mavlink console
2018-04-16 20:43:33 -04:00
Daniel Agar
bb13b602e2 commander arming_state_transition cleanup preflight and prearm calls
- only call prearm if preflight passes
 - prearm always provide feedback
2018-04-16 20:43:33 -04:00
Daniel Agar
208e320975 commander prearm_check is always prearm 2018-04-16 20:43:33 -04:00
Daniel Agar
e5d9c826d8 commander state machine fix preflight and prearm error
-  fixes #9155
2018-04-16 20:43:33 -04:00
Daniel Agar
35bf37d617 commander state machine helper shorten names 2018-04-16 20:43:33 -04:00
Daniel Agar
0f6a94894d commander state machine helper fix code style 2018-03-29 10:25:56 -04:00
Daniel Agar
db7e8635a2 commander state machine helper pass battery and safety as const references 2018-03-29 10:25:56 -04:00
Daniel Agar
4ccfc280c8 commander arming_state_transition add HIL boolean 2018-03-29 10:25:56 -04:00