diff --git a/msg/actuator_armed.msg b/msg/actuator_armed.msg index 4a3482afe4..7a33dccad1 100644 --- a/msg/actuator_armed.msg +++ b/msg/actuator_armed.msg @@ -6,3 +6,4 @@ bool lockdown # Set to true if actuators are forced to being disabled (due to e bool manual_lockdown # Set to true if manual throttle kill switch is engaged bool force_failsafe # Set to true if the actuators are forced to the failsafe position bool in_esc_calibration_mode # IO/FMU should ignore messages from the actuator controls topics +bool soft_stop # Set to true if we need to ESCs to remove the idle constraint diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 9daffe2f06..cedad28d2b 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -2103,6 +2103,8 @@ int commander_thread_main(int argc, char *argv[]) status.in_transition_to_fw = vtol_status.in_transition_to_fw; status_flags.vtol_transition_failure = vtol_status.vtol_transition_failsafe; status_flags.vtol_transition_failure_cmd = vtol_status.vtol_transition_failsafe; + + armed.soft_stop = !status.is_rotary_wing; } status_changed = true; diff --git a/src/modules/uavcan/uavcan_main.cpp b/src/modules/uavcan/uavcan_main.cpp index e6bbc0d078..d6fb8739cf 100644 --- a/src/modules/uavcan/uavcan_main.cpp +++ b/src/modules/uavcan/uavcan_main.cpp @@ -647,9 +647,8 @@ int UavcanNode::init(uavcan::NodeID node_id) } { - std::int32_t idle_throttle_when_armed = 0; - (void) param_get(param_find("UAVCAN_ESC_IDLT"), &idle_throttle_when_armed); - _esc_controller.enable_idle_throttle_when_armed(idle_throttle_when_armed > 0); + (void) param_get(param_find("UAVCAN_ESC_IDLT"), &_idle_throttle_when_armed); + _esc_controller.enable_idle_throttle_when_armed(_idle_throttle_when_armed > 0); } ret = _hardpoint_controller.init(); @@ -970,6 +969,13 @@ int UavcanNode::run() bool set_armed = _armed.armed && !_armed.lockdown && !_armed.manual_lockdown && !_test_in_progress; arm_actuators(set_armed); + + if (_armed.soft_stop) { + _esc_controller.enable_idle_throttle_when_armed(false); + + } else { + _esc_controller.enable_idle_throttle_when_armed(_idle_throttle_when_armed > 0); + } } } diff --git a/src/modules/uavcan/uavcan_main.hpp b/src/modules/uavcan/uavcan_main.hpp index f84dff1630..361594ccd1 100644 --- a/src/modules/uavcan/uavcan_main.hpp +++ b/src/modules/uavcan/uavcan_main.hpp @@ -199,6 +199,7 @@ private: orb_id_t _control_topics[NUM_ACTUATOR_CONTROL_GROUPS_UAVCAN] = {}; pollfd _poll_fds[UAVCAN_NUM_POLL_FDS] = {}; unsigned _poll_fds_num = 0; + int32_t _idle_throttle_when_armed = 0; int _actuator_direct_sub = -1; ///< uORB subscription of the actuator_direct topic uint8_t _actuator_direct_poll_fd_num = 0;