UAVCAN: disable ESCs when in VTOL fixed-wing

This commit is contained in:
Andreas Antener 2017-03-08 20:45:28 +01:00 committed by Lorenz Meier
parent 1fd343b5cc
commit 00efbffea9
4 changed files with 13 additions and 3 deletions

View File

@ -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

View File

@ -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;

View File

@ -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);
}
}
}

View File

@ -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;