From ec6dd286fcda8ee8acd798b667461687eac3e1da Mon Sep 17 00:00:00 2001 From: Silvan Date: Wed, 7 Jan 2026 11:37:26 +0100 Subject: [PATCH] Commander: COM_RCL_EXCEPT consider all auto modes triggered by action in bit 1 Signed-off-by: Silvan --- docs/en/config/safety.md | 6 +++--- src/modules/commander/commander_params.c | 3 ++- src/modules/commander/failsafe/failsafe.cpp | 22 ++++++++++++++------- src/modules/commander/failsafe/failsafe.h | 2 +- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/docs/en/config/safety.md b/docs/en/config/safety.md index 5640f1dcd7..df12c630b1 100644 --- a/docs/en/config/safety.md +++ b/docs/en/config/safety.md @@ -121,8 +121,8 @@ PX4 and the receiver may also need to be configured in order to _detect RC loss_ ![Safety - RC Loss (QGC)](../../assets/qgc/setup/safety/safety_rc_loss.png) -The QGCroundControl Safety UI allows you to set the [failsafe action](#failsafe-actions) and [RC Loss timeout](#COM_RC_LOSS_T). -Users that want to disable the RC loss failsafe in specific automatic modes (mission, hold, offboard) can do so using the parameter [COM_RCL_EXCEPT](#COM_RCL_EXCEPT). +The QGCroundControl Safety UI allows you to set the [failsafe action](#failsafe-actions) and [manual control loss timeout](#COM_RC_LOSS_T). +Users that want to disable this failsafe in specific modes can do so using the parameter [COM_RCL_EXCEPT](#COM_RCL_EXCEPT). Additional (and underlying) parameter settings are shown below. @@ -131,7 +131,7 @@ Additional (and underlying) parameter settings are shown below. | [COM_RC_LOSS_T](../advanced_config/parameter_reference.md#COM_RC_LOSS_T) | Manual Control Loss Timeout | Time after last setpoint received from the selected manual control source after which manual control is considered lost. This must be kept short because the vehicle will continue to fly using the old manual control setpoint until the timeout triggers. | | [COM_FAIL_ACT_T](../advanced_config/parameter_reference.md#COM_FAIL_ACT_T) | Failsafe Reaction Delay | Delay in seconds between failsafe condition being triggered (`COM_RC_LOSS_T`) and failsafe action (RTL, Land, Hold). In this state the vehicle waits in hold mode for the manual control source to reconnect. This might be set longer for long-range flights so that intermittent connection loss doesn't immediately invoke the failsafe. It can be to zero so that the failsafe triggers immediately. | | [NAV_RCL_ACT](../advanced_config/parameter_reference.md#NAV_RCL_ACT) | Failsafe Action | Disabled, Loiter, Return, Land, Disarm, Terminate. | -| [COM_RCL_EXCEPT](../advanced_config/parameter_reference.md#COM_RCL_EXCEPT) | RC Loss Exceptions | Set the modes in which manual control loss is ignored: Mission, Hold, Offboard. | +| [COM_RCL_EXCEPT](../advanced_config/parameter_reference.md#COM_RCL_EXCEPT) | RC Loss Exceptions | Set the modes in which manual control loss is ignored. | ## Data Link Loss Failsafe diff --git a/src/modules/commander/commander_params.c b/src/modules/commander/commander_params.c index 0f3a97de4b..c060884d68 100644 --- a/src/modules/commander/commander_params.c +++ b/src/modules/commander/commander_params.c @@ -609,11 +609,12 @@ PARAM_DEFINE_INT32(NAV_RCL_ACT, 2); * * Specify modes where manual control loss is ignored and no failsafe is triggered. * External modes requiring stick input will still failsafe. + * Auto modes are: Hold, Takeoff, Land, RTL, Descend, Follow Target, Precland, Orbit. * * @min 0 * @max 31 * @bit 0 Mission - * @bit 1 Hold + * @bit 1 Auto modes * @bit 2 Offboard * @bit 3 External Mode * @bit 4 Altitude Cruise diff --git a/src/modules/commander/failsafe/failsafe.cpp b/src/modules/commander/failsafe/failsafe.cpp index e366e12947..f145d332b5 100644 --- a/src/modules/commander/failsafe/failsafe.cpp +++ b/src/modules/commander/failsafe/failsafe.cpp @@ -464,13 +464,21 @@ void Failsafe::checkStateAndMode(const hrt_abstime &time_us, const State &state, const bool rc_loss_ignored_mission = state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_AUTO_MISSION && (_param_com_rcl_except.get() & (int)ManualControlLossExceptionBits::Mission); - const bool rc_loss_ignored_loiter = state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_AUTO_LOITER - && (_param_com_rcl_except.get() & (int)ManualControlLossExceptionBits::Hold); + + const bool rc_loss_ignored_auto_modes = (state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_AUTO_LOITER || + state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_AUTO_TAKEOFF || + state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_AUTO_VTOL_TAKEOFF || + state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_AUTO_LAND || + state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_AUTO_RTL || + state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_DESCEND || + state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_AUTO_FOLLOW_TARGET || + state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_AUTO_PRECLAND || + state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_ORBIT) + && (_param_com_rcl_except.get() & (int)ManualControlLossExceptionBits::AutoModes); + const bool rc_loss_ignored_offboard = state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_OFFBOARD && (_param_com_rcl_except.get() & (int)ManualControlLossExceptionBits::Offboard); - const bool rc_loss_ignored_takeoff = (state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_AUTO_TAKEOFF || - 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_altitude_cruise = (state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_ALTITUDE_CRUISE && (_param_com_rcl_except.get() & (int)ManualControlLossExceptionBits::AltitudeCruise)); @@ -486,8 +494,8 @@ void Failsafe::checkStateAndMode(const hrt_abstime &time_us, const State &state, 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 || rc_loss_ignored_external_mode || ignore_any_link_loss_vtol_takeoff_fixedwing + const bool rc_loss_ignored = rc_loss_ignored_mission || rc_loss_ignored_auto_modes || rc_loss_ignored_offboard || + rc_loss_ignored_external_mode || ignore_any_link_loss_vtol_takeoff_fixedwing || _manual_control_lost_at_arming || rc_loss_ignored_altitude_cruise; if (_param_com_rc_in_mode.get() != int32_t(RcInMode::DisableManualControl) && !rc_loss_ignored) { diff --git a/src/modules/commander/failsafe/failsafe.h b/src/modules/commander/failsafe/failsafe.h index 9a9384f621..2e8bc171b3 100644 --- a/src/modules/commander/failsafe/failsafe.h +++ b/src/modules/commander/failsafe/failsafe.h @@ -55,7 +55,7 @@ private: enum class ManualControlLossExceptionBits : int32_t { Mission = (1 << 0), - Hold = (1 << 1), + AutoModes = (1 << 1), Offboard = (1 << 2), ExternalMode = (1 << 3), AltitudeCruise = (1 << 4)