From e70223c2be3b273efc546390ab5608f21ec09cef Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 29 Jul 2016 13:43:24 +0200 Subject: [PATCH] Allow transition commands also in manual if no switch is used --- .../vtol_att_control/vtol_att_control_main.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/modules/vtol_att_control/vtol_att_control_main.cpp b/src/modules/vtol_att_control/vtol_att_control_main.cpp index 330c80821b..06a37c67c5 100644 --- a/src/modules/vtol_att_control/vtol_att_control_main.cpp +++ b/src/modules/vtol_att_control/vtol_att_control_main.cpp @@ -89,7 +89,7 @@ VtolAttitudeControl::VtolAttitudeControl() : _vtol_vehicle_status_pub(nullptr), _v_rates_sp_pub(nullptr), _v_att_sp_pub(nullptr), - + _transition_command(vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC), _abort_front_transition(false) { @@ -481,11 +481,15 @@ VtolAttitudeControl::handle_command() bool VtolAttitudeControl::is_fixed_wing_requested() { - bool to_fw = _manual_control_sp.transition_switch == manual_control_setpoint_s::SWITCH_POS_ON; + bool to_fw = false; - // listen to transition commands if not in manual - if (!_v_control_mode.flag_control_manual_enabled) { - to_fw = _transition_command == vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW; + if (_manual_control_sp.transition_switch != manual_control_setpoint_s::SWITCH_POS_NONE && + _v_control_mode.flag_control_manual_enabled) { + to_fw = (_manual_control_sp.transition_switch == manual_control_setpoint_s::SWITCH_POS_ON); + + } else { + // listen to transition commands if not in manual or mode switch is not mapped + to_fw = (_transition_command == vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW); } // handle abort request