Commander: add option to ignore manual control loss in external modes

This commit is contained in:
Matthias Grob
2025-07-15 13:08:18 +02:00
committed by Silvan Fuhrer
parent a755dfa07f
commit f9b811b0c5
3 changed files with 18 additions and 4 deletions
+4 -2
View File
@@ -618,13 +618,15 @@ PARAM_DEFINE_INT32(NAV_RCL_ACT, 2);
/**
* RC loss exceptions
*
* Specify modes in which RC loss is ignored and the failsafe action not triggered.
* Specify modes where manual control loss is ignored and no failsafe is triggered.
* External modes requiring stick input will still failsafe.
*
* @min 0
* @max 7
* @max 15
* @bit 0 Mission
* @bit 1 Hold
* @bit 2 Offboard
* @bit 3 External Mode
* @group Commander
*/
PARAM_DEFINE_INT32(COM_RCL_EXCEPT, 0);
+12 -1
View File
@@ -472,8 +472,19 @@ void Failsafe::checkStateAndMode(const hrt_abstime &time_us, const State &state,
state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_AUTO_VTOL_TAKEOFF)
&& (_param_com_rcl_except.get() & (int)ManualControlLossExceptionBits::Hold);
const bool rc_loss_ignored_external_mode =
(state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_EXTERNAL1 ||
state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_EXTERNAL2 ||
state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_EXTERNAL3 ||
state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_EXTERNAL4 ||
state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_EXTERNAL5 ||
state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_EXTERNAL6 ||
state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_EXTERNAL7 ||
state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_EXTERNAL8)
&& (_param_com_rcl_except.get() & (int)ManualControlLossExceptionBits::ExternalMode);
const bool rc_loss_ignored = rc_loss_ignored_mission || rc_loss_ignored_loiter || rc_loss_ignored_offboard ||
rc_loss_ignored_takeoff || ignore_any_link_loss_vtol_takeoff_fixedwing
rc_loss_ignored_takeoff || rc_loss_ignored_external_mode || ignore_any_link_loss_vtol_takeoff_fixedwing
|| _manual_control_lost_at_arming;
if (_param_com_rc_in_mode.get() != int32_t(RcInMode::StickInputDisabled) && !rc_loss_ignored) {
+2 -1
View File
@@ -56,7 +56,8 @@ private:
enum class ManualControlLossExceptionBits : int32_t {
Mission = (1 << 0),
Hold = (1 << 1),
Offboard = (1 << 2)
Offboard = (1 << 2),
ExternalMode = (1 << 3)
};
enum class DatalinkLossExceptionBits : int32_t {