From e0cdcdb43619ea545e982375b5e2d9c6aca21b10 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Tue, 24 Jun 2025 17:48:04 +0200 Subject: [PATCH] Remove COM_POSCTL_NAVL In an effort to reduce configuration space. I've not seen use for this option. If a pilot flies manually in position mode he has some visual reference of the vehicle and can do better than an autonomous mode without position reference. Also by now we have nudging in Descend mode so the pilot can still give input and the only difference is it automatically goes down instead of the pilot having to descend by stick to land. --- .../airframes/60002_gz_uuv_bluerov2_heavy | 1 - .../init.d-posix/airframes/70000_gz_atmos | 1 - .../init.d/airframes/60002_uuv_bluerov2_heavy | 1 - .../init.d/airframes/70000_atmos | 1 - .../amovlabf410_drone_v1.15.4.params | 5 +- docs/en/config/safety.md | 12 ----- src/modules/commander/Commander.hpp | 2 +- src/modules/commander/UserModeIntention.cpp | 6 +-- src/modules/commander/UserModeIntention.hpp | 9 +--- src/modules/commander/commander_params.c | 12 ----- src/modules/commander/failsafe/failsafe.cpp | 50 +++++-------------- src/modules/commander/failsafe/failsafe.h | 6 --- 12 files changed, 20 insertions(+), 86 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d-posix/airframes/60002_gz_uuv_bluerov2_heavy b/ROMFS/px4fmu_common/init.d-posix/airframes/60002_gz_uuv_bluerov2_heavy index 287589a0526..b80bf079b7c 100644 --- a/ROMFS/px4fmu_common/init.d-posix/airframes/60002_gz_uuv_bluerov2_heavy +++ b/ROMFS/px4fmu_common/init.d-posix/airframes/60002_gz_uuv_bluerov2_heavy @@ -34,7 +34,6 @@ param set-default COM_LOW_BAT_ACT 0 param set-default NAV_DLL_ACT 0 param set-default GF_ACTION 1 param set-default NAV_RCL_ACT 1 -param set-default COM_POSCTL_NAVL 2 # disable attitude failure detection param set-default FD_FAIL_P 0 diff --git a/ROMFS/px4fmu_common/init.d-posix/airframes/70000_gz_atmos b/ROMFS/px4fmu_common/init.d-posix/airframes/70000_gz_atmos index c539586ae5d..49ef971307a 100644 --- a/ROMFS/px4fmu_common/init.d-posix/airframes/70000_gz_atmos +++ b/ROMFS/px4fmu_common/init.d-posix/airframes/70000_gz_atmos @@ -45,7 +45,6 @@ param set-default COM_LOW_BAT_ACT 0 param set-default NAV_DLL_ACT 0 param set-default GF_ACTION 1 param set-default NAV_RCL_ACT 1 -param set-default COM_POSCTL_NAVL 2 # disable attitude failure detection param set-default FD_FAIL_P 0 diff --git a/ROMFS/px4fmu_common/init.d/airframes/60002_uuv_bluerov2_heavy b/ROMFS/px4fmu_common/init.d/airframes/60002_uuv_bluerov2_heavy index d397e5deae2..7ad928367d0 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/60002_uuv_bluerov2_heavy +++ b/ROMFS/px4fmu_common/init.d/airframes/60002_uuv_bluerov2_heavy @@ -45,7 +45,6 @@ param set-default COM_LOW_BAT_ACT 0 param set-default NAV_DLL_ACT 0 param set-default GF_ACTION 1 param set-default NAV_RCL_ACT 1 -param set-default COM_POSCTL_NAVL 2 # disable attitude failure detection param set-default FD_FAIL_P 0 diff --git a/ROMFS/px4fmu_common/init.d/airframes/70000_atmos b/ROMFS/px4fmu_common/init.d/airframes/70000_atmos index 37b676cef1e..3ad05a85e08 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/70000_atmos +++ b/ROMFS/px4fmu_common/init.d/airframes/70000_atmos @@ -35,7 +35,6 @@ param set-default COM_LOW_BAT_ACT 0 param set-default NAV_DLL_ACT 0 param set-default GF_ACTION 1 param set-default NAV_RCL_ACT 1 -param set-default COM_POSCTL_NAVL 2 # Set Mocap Vision frame param set EKF2_EV_CTRL 15 diff --git a/docs/assets/airframes/multicopter/amovlab_f410/amovlabf410_drone_v1.15.4.params b/docs/assets/airframes/multicopter/amovlab_f410/amovlabf410_drone_v1.15.4.params index f80c1b5a3a8..0d16ea9f014 100644 --- a/docs/assets/airframes/multicopter/amovlab_f410/amovlabf410_drone_v1.15.4.params +++ b/docs/assets/airframes/multicopter/amovlab_f410/amovlabf410_drone_v1.15.4.params @@ -1,8 +1,8 @@ # Onboard parameters for Vehicle 1 # # Stack: PX4 Pro -# Vehicle: ¶àÐýÒí -# Version: 1.15.4 +# Vehicle: Multi-Rotor +# Version: 1.15.4 # Git Revision: 99c40407ff000000 # # Vehicle-Id Component-Id Name Value Type @@ -318,7 +318,6 @@ 1 1 COM_OBS_AVOID 0 6 1 1 COM_OF_LOSS_T 1.000000000000000000 9 1 1 COM_PARACHUTE 0 6 -1 1 COM_POSCTL_NAVL 0 6 1 1 COM_POS_FS_DELAY 1 6 1 1 COM_POS_FS_EPH 5.000000000000000000 9 1 1 COM_POS_LOW_EPH -1.000000000000000000 9 diff --git a/docs/en/config/safety.md b/docs/en/config/safety.md index 92a302ad3e3..a7410307440 100644 --- a/docs/en/config/safety.md +++ b/docs/en/config/safety.md @@ -206,23 +206,11 @@ The relevant parameters shown below. ### Position Loss Failsafe Action -The failure action is controlled by [COM_POSCTL_NAVL](../advanced_config/parameter_reference.md#COM_POSCTL_NAVL), based on whether RC control is assumed to be available (and altitude information): - -- `0`: Remote control available. - Switch to _Altitude mode_ if a height estimate is available, otherwise _Stabilized mode_. -- `1`: Remote control _not_ available. - Switch to _Descend mode_ if a height estimate is available, otherwise enter flight termination. - _Descend mode_ is a landing mode that does not require a position estimate. - Fixed-wing planes, and VTOLs not configured to land in hover ([NAV_FORCE_VT](../advanced_config/parameter_reference.md#NAV_FORCE_VT)), have a parameter ([FW_GPSF_LT](../advanced_config/parameter_reference.md#FW_GPSF_LT)) that defines how long they will loiter (circle with a constant roll angle ([FW_GPSF_R](../advanced_config/parameter_reference.md#FW_GPSF_R)) at the current altitude) after losing position before attempting to land. If VTOLs have are configured to switch to hover for landing ([NAV_FORCE_VT](../advanced_config/parameter_reference.md#NAV_FORCE_VT)) then they will first transition and then descend. The relevant parameters for all vehicles shown below. -| Parameter | Description | -| -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | -| [COM_POSCTL_NAVL](../advanced_config/parameter_reference.md#COM_POSCTL_NAVL) | Position control navigation loss response during mission. Values: `0` - assume use of RC, `1` - Assume no RC. | - Parameters that only affect Fixed-wing vehicles: | Parameter | Description | diff --git a/src/modules/commander/Commander.hpp b/src/modules/commander/Commander.hpp index 1d7841cdc87..e079d13ee88 100644 --- a/src/modules/commander/Commander.hpp +++ b/src/modules/commander/Commander.hpp @@ -230,7 +230,7 @@ private: _health_and_arming_checks.externalChecks() #endif }; - UserModeIntention _user_mode_intention {this, _vehicle_status, _health_and_arming_checks, &_mode_management}; + UserModeIntention _user_mode_intention {_vehicle_status, _health_and_arming_checks, &_mode_management}; const failsafe_flags_s &_failsafe_flags{_health_and_arming_checks.failsafeFlags()}; HomePosition _home_position{_failsafe_flags}; diff --git a/src/modules/commander/UserModeIntention.cpp b/src/modules/commander/UserModeIntention.cpp index 086f9501b32..556bddbd183 100644 --- a/src/modules/commander/UserModeIntention.cpp +++ b/src/modules/commander/UserModeIntention.cpp @@ -34,9 +34,9 @@ #include "UserModeIntention.hpp" -UserModeIntention::UserModeIntention(ModuleParams *parent, const vehicle_status_s &vehicle_status, +UserModeIntention::UserModeIntention(const vehicle_status_s &vehicle_status, const HealthAndArmingChecks &health_and_arming_checks, ModeChangeHandler *handler) - : ModuleParams(parent), _vehicle_status(vehicle_status), _health_and_arming_checks(health_and_arming_checks), + : _vehicle_status(vehicle_status), _health_and_arming_checks(health_and_arming_checks), _handler(handler) { } @@ -59,7 +59,7 @@ bool UserModeIntention::change(uint8_t user_intended_nav_state, ModeChangeSource allow_change = _health_and_arming_checks.canRun(user_intended_nav_state); // Check fallback - if (!allow_change && allow_fallback && _param_com_posctl_navl.get() == 0) { + if (!allow_change && allow_fallback) { if (user_intended_nav_state == vehicle_status_s::NAVIGATION_STATE_POSCTL) { allow_change = _health_and_arming_checks.canRun(vehicle_status_s::NAVIGATION_STATE_ALTCTL); // We still use the original user intended mode. The failsafe state machine will then set the diff --git a/src/modules/commander/UserModeIntention.hpp b/src/modules/commander/UserModeIntention.hpp index b8b6827e063..cfb4e3998be 100644 --- a/src/modules/commander/UserModeIntention.hpp +++ b/src/modules/commander/UserModeIntention.hpp @@ -35,7 +35,6 @@ #include #include "HealthAndArmingChecks/HealthAndArmingChecks.hpp" -#include enum class ModeChangeSource { User, ///< RC or MAVLink @@ -58,10 +57,10 @@ public: }; -class UserModeIntention : ModuleParams +class UserModeIntention { public: - UserModeIntention(ModuleParams *parent, const vehicle_status_s &vehicle_status, + UserModeIntention(const vehicle_status_s &vehicle_status, const HealthAndArmingChecks &health_and_arming_checks, ModeChangeHandler *handler); ~UserModeIntention() = default; @@ -102,8 +101,4 @@ private: bool _ever_had_mode_change{false}; ///< true if there was ever a mode change call (also if the same mode as already set) bool _had_mode_change{false}; ///< true if there was a mode change call since the last getHadModeChangeAndClear() - - DEFINE_PARAMETERS( - (ParamInt) _param_com_posctl_navl - ); }; diff --git a/src/modules/commander/commander_params.c b/src/modules/commander/commander_params.c index 565c6406be4..1e194ac5df5 100644 --- a/src/modules/commander/commander_params.c +++ b/src/modules/commander/commander_params.c @@ -461,18 +461,6 @@ PARAM_DEFINE_FLOAT(COM_RC_STICK_OV, 30.0f); */ PARAM_DEFINE_INT32(COM_ARM_MIS_REQ, 0); -/** - * Position mode navigation loss response - * - * This sets the flight mode that will be used if navigation accuracy is no longer adequate for position control in manual Position mode. - * - * @value 0 Altitude mode - * @value 1 Land mode (descend) - * - * @group Commander - */ -PARAM_DEFINE_INT32(COM_POSCTL_NAVL, 0); - /** * Require arm authorization to arm * diff --git a/src/modules/commander/failsafe/failsafe.cpp b/src/modules/commander/failsafe/failsafe.cpp index 5c3578fb894..cdc770190c0 100644 --- a/src/modules/commander/failsafe/failsafe.cpp +++ b/src/modules/commander/failsafe/failsafe.cpp @@ -668,46 +668,20 @@ FailsafeBase::Action Failsafe::checkModeFallback(const failsafe_flags_s &status_ } } - // posctrl - switch (position_control_navigation_loss_response(_param_com_posctl_navl.get())) { - case position_control_navigation_loss_response::Altitude_Manual: // AltCtrl/Manual - - // PosCtrl/PositionSlow -> AltCtrl - if ((user_intended_mode == vehicle_status_s::NAVIGATION_STATE_POSCTL || - user_intended_mode == vehicle_status_s::NAVIGATION_STATE_POSITION_SLOW) - && !modeCanRun(status_flags, user_intended_mode)) { - action = Action::FallbackAltCtrl; - user_intended_mode = vehicle_status_s::NAVIGATION_STATE_ALTCTL; - } - - // AltCtrl -> Stabilized - if (user_intended_mode == vehicle_status_s::NAVIGATION_STATE_ALTCTL - && !modeCanRun(status_flags, user_intended_mode)) { - action = Action::FallbackStab; - user_intended_mode = vehicle_status_s::NAVIGATION_STATE_STAB; - } - - break; - - case position_control_navigation_loss_response::Land_Descend: // Land/Terminate - - // PosCtrl/PositionSlow -> Land - if ((user_intended_mode == vehicle_status_s::NAVIGATION_STATE_POSCTL || - user_intended_mode == vehicle_status_s::NAVIGATION_STATE_POSITION_SLOW) - && !modeCanRun(status_flags, user_intended_mode)) { - action = Action::Land; - user_intended_mode = vehicle_status_s::NAVIGATION_STATE_AUTO_LAND; - - // Land -> Descend - if (!modeCanRun(status_flags, user_intended_mode)) { - action = Action::Descend; - user_intended_mode = vehicle_status_s::NAVIGATION_STATE_DESCEND; - } - } - - break; + // PosCtrl/PositionSlow -> AltCtrl + if ((user_intended_mode == vehicle_status_s::NAVIGATION_STATE_POSCTL || + user_intended_mode == vehicle_status_s::NAVIGATION_STATE_POSITION_SLOW) + && !modeCanRun(status_flags, user_intended_mode)) { + action = Action::FallbackAltCtrl; + user_intended_mode = vehicle_status_s::NAVIGATION_STATE_ALTCTL; } + // AltCtrl -> Stabilized + if (user_intended_mode == vehicle_status_s::NAVIGATION_STATE_ALTCTL + && !modeCanRun(status_flags, user_intended_mode)) { + action = Action::FallbackStab; + user_intended_mode = vehicle_status_s::NAVIGATION_STATE_STAB; + } // Last, check can_run for intended mode if (!modeCanRun(status_flags, user_intended_mode)) { diff --git a/src/modules/commander/failsafe/failsafe.h b/src/modules/commander/failsafe/failsafe.h index d7ac7c75c29..f9382e04285 100644 --- a/src/modules/commander/failsafe/failsafe.h +++ b/src/modules/commander/failsafe/failsafe.h @@ -85,11 +85,6 @@ private: Disarm = 7, }; - enum class position_control_navigation_loss_response : int32_t { - Altitude_Manual = 0, - Land_Descend = 1, - }; - enum class actuator_failure_failsafe_mode : int32_t { Warning_only = 0, Hold_mode = 1, @@ -202,7 +197,6 @@ private: (ParamInt) _param_com_rcl_except, (ParamInt) _param_com_dll_except, (ParamInt) _param_com_rc_in_mode, - (ParamInt) _param_com_posctl_navl, (ParamInt) _param_gf_action, (ParamFloat) _param_com_spoolup_time, (ParamInt) _param_com_imb_prop_act,