From 46105f735e5a6613a31cf4e1ba6f9131982ac228 Mon Sep 17 00:00:00 2001 From: Andreas Antener Date: Mon, 15 Aug 2016 08:56:31 +0200 Subject: [PATCH] finish back transition when a mode change from manual to auto happens during the back transition --- src/modules/vtol_att_control/vtol_att_control_main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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 4d0083bf99..a97770fbe1 100644 --- a/src/modules/vtol_att_control/vtol_att_control_main.cpp +++ b/src/modules/vtol_att_control/vtol_att_control_main.cpp @@ -736,6 +736,13 @@ void VtolAttitudeControl::task_main() } else if (_vtol_type->get_mode() == FIXED_WING) { _transition_command = vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW; } + + /* We want to make sure that a mode change (manual>auto) during the back transition + * doesn't result in an unsafe state. This prevents the instant fall back to + * fixed-wing on the switch from manual to auto */ + } else if (_vtol_type->get_mode() == TRANSITION_TO_MC) { + _transition_command = vehicle_status_s::VEHICLE_VTOL_STATE_MC; + } } // check in which mode we are in and call mode specific functions