mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-25 11:50:35 +08:00
Commander: COM_RCL_EXCEPT consider all auto modes triggered by action in bit 1
Signed-off-by: Silvan <silvan@auterion.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user