commander: use new failsafe state machine and add user intention class

This commit is contained in:
Beat Küng
2022-10-11 22:31:20 -04:00
committed by Daniel Agar
parent a04230faa1
commit 455b885f86
44 changed files with 1927 additions and 2280 deletions
+18 -35
View File
@@ -283,13 +283,14 @@ PARAM_DEFINE_INT32(COM_ARM_SWISBTN, 0);
PARAM_DEFINE_INT32(COM_LOW_BAT_ACT, 0);
/**
* Delay between battery state change and failsafe reaction
* Delay between failsafe condition triggered and failsafe reaction
*
* Battery state requires action -> wait COM_BAT_ACT_T seconds in Hold mode
* for the user to realize and take a custom action
* -> React with failsafe action COM_LOW_BAT_ACT
* Before entering failsafe (RTL, Land, Hold), wait COM_FAIL_ACT_T seconds in Hold mode
* for the user to realize.
* During that time the user cannot take over control.
* Afterwards the configured failsafe action is triggered and the user may take over.
*
* A zero value disables the delay.
* A zero value disables the delay and the user cannot take over via stick movements (switching modes is still allowed).
*
* @group Commander
* @unit s
@@ -297,7 +298,7 @@ PARAM_DEFINE_INT32(COM_LOW_BAT_ACT, 0);
* @max 25.0
* @decimal 3
*/
PARAM_DEFINE_FLOAT(COM_BAT_ACT_T, 5.f);
PARAM_DEFINE_FLOAT(COM_FAIL_ACT_T, 5.f);
/**
* Imbalanced propeller failsafe mode
@@ -319,7 +320,7 @@ PARAM_DEFINE_INT32(COM_IMB_PROP_ACT, 0);
/**
* Time-out to wait when offboard connection is lost before triggering offboard lost action.
*
* See COM_OBL_ACT and COM_OBL_RC_ACT to configure action.
* See COM_OBL_RC_ACT to configure action.
*
* @group Commander
* @unit s
@@ -329,27 +330,10 @@ PARAM_DEFINE_INT32(COM_IMB_PROP_ACT, 0);
*/
PARAM_DEFINE_FLOAT(COM_OF_LOSS_T, 1.0f);
/**
* Set offboard loss failsafe mode
*
* The offboard loss failsafe will only be entered after a timeout,
* set by COM_OF_LOSS_T in seconds.
*
* @value -1 Disabled
* @value 0 Land mode
* @value 1 Hold mode
* @value 2 Return mode
* @value 3 Terminate
* @value 4 Lockdown
*
* @group Commander
*/
PARAM_DEFINE_INT32(COM_OBL_ACT, 0);
/**
* Set command after a quadchute
*
* @value -1 No action: stay in current flight mode
* @value -1 Warning only
* @value 0 Return mode
* @value 1 Land mode
* @value 2 Hold mode
@@ -358,12 +342,11 @@ PARAM_DEFINE_INT32(COM_OBL_ACT, 0);
PARAM_DEFINE_INT32(COM_QC_ACT, 0);
/**
* Set offboard loss failsafe mode when RC is available
* Set offboard loss failsafe mode
*
* The offboard loss failsafe will only be entered after a timeout,
* set by COM_OF_LOSS_T in seconds.
*
* @value -1 Disabled
* @value 0 Position mode
* @value 1 Altitude mode
* @value 2 Manual
@@ -371,7 +354,7 @@ PARAM_DEFINE_INT32(COM_QC_ACT, 0);
* @value 4 Land mode
* @value 5 Hold mode
* @value 6 Terminate
* @value 7 Lockdown
* @value 7 Disarm
* @group Commander
*/
PARAM_DEFINE_INT32(COM_OBL_RC_ACT, 0);
@@ -676,10 +659,10 @@ PARAM_DEFINE_INT32(COM_ARM_MIS_REQ, 0);
*
* If Altitude/Manual is selected: assume use of remote control after fallback. Switch to Altitude mode if a height estimate is available, else switch to MANUAL.
*
* If Land/Terminate is selected: assume no use of remote control after fallback. Switch to Land mode if a height estimate is available, else switch to TERMINATION.
* If Land/Descend is selected: assume no use of remote control after fallback. Switch to Land mode if a height estimate is available, else switch to Descend.
*
* @value 0 Altitude/Manual
* @value 1 Land/Terminate
* @value 1 Land/Descend
*
* @group Commander
*/
@@ -813,7 +796,7 @@ PARAM_DEFINE_INT32(COM_TAKEOFF_ACT, 0);
* @value 2 Return mode
* @value 3 Land mode
* @value 5 Terminate
* @value 6 Lockdown
* @value 6 Disarm
* @min 0
* @max 6
*
@@ -832,7 +815,7 @@ PARAM_DEFINE_INT32(NAV_DLL_ACT, 0);
* @value 2 Return mode
* @value 3 Land mode
* @value 5 Terminate
* @value 6 Lockdown
* @value 6 Disarm
* @min 1
* @max 6
*
@@ -862,7 +845,7 @@ PARAM_DEFINE_INT32(COM_RCL_EXCEPT, 0);
*
* @min 0
* @max 3
* @value 0 Disabled
* @value 0 Warning only
* @value 1 Hold mode
* @value 2 Land mode
* @value 3 Return mode
@@ -988,8 +971,8 @@ PARAM_DEFINE_INT32(COM_POWER_COUNT, 1);
/**
* Timeout for detecting a failure after takeoff
*
* A non-zero, positive value specifies the timeframe in seconds within failure detector is allowed to put the vehicle into
* a lockdown state if attitude exceeds the limits defined in FD_FAIL_P and FD_FAIL_R.
* A non-zero, positive value specifies the timeframe in seconds within failure detector is allowed to disarm the vehicle
* if attitude exceeds the limits defined in FD_FAIL_P and FD_FAIL_R.
* The check is not executed for flight modes that do support acrobatic maneuvers, e.g: Acro (MC/FW) and Manual (FW).
* A zero or negative value means that the check is disabled.
*