From 5b8b4454250ad83de2d6d12812fca5900e9eca94 Mon Sep 17 00:00:00 2001 From: Andreas Antener Date: Wed, 10 Feb 2016 16:52:06 +0100 Subject: [PATCH] consider transition command for the correct state --- src/lib/ecl | 2 +- .../vtol_att_control/vtol_att_control_main.cpp | 12 +++++++----- src/modules/vtol_att_control/vtol_att_control_main.h | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lib/ecl b/src/lib/ecl index b21a49b3f9..0a9f7e58db 160000 --- a/src/lib/ecl +++ b/src/lib/ecl @@ -1 +1 @@ -Subproject commit b21a49b3f9b7267663fd79a92f50c2db78eae762 +Subproject commit 0a9f7e58dbb5708fc894a865376ede6cbb675fd4 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 3a10472ca0..302850778a 100644 --- a/src/modules/vtol_att_control/vtol_att_control_main.cpp +++ b/src/modules/vtol_att_control/vtol_att_control_main.cpp @@ -43,6 +43,7 @@ * @author Thomas Gubler * @author David Vorsin * @author Sander Smeets + * @author Andreas Antener * */ #include "vtol_att_control_main.h" @@ -428,13 +429,14 @@ VtolAttitudeControl::is_fixed_wing_requested() { bool to_fw = _manual_control_sp.aux1 > 0.0f; - if (_v_control_mode.flag_control_offboard_enabled || _v_control_mode.flag_control_auto_enabled) { + // listen to transition commands if not in manual + if (!_v_control_mode.flag_control_manual_enabled) { to_fw = _transition_command == vehicle_status_s::VEHICLE_VTOL_STATE_FW; } // handle abort request - if(_abort_front_transition) { - if(to_fw) { + if (_abort_front_transition) { + if (to_fw) { to_fw = false; } else { // the state changed to mc mode, reset the abort request @@ -666,8 +668,8 @@ void VtolAttitudeControl::task_main() // update the vtol state machine which decides which mode we are in _vtol_type->update_vtol_state(); - // reset transition command if not in offboard control - if (!_v_control_mode.flag_control_offboard_enabled) { + // reset transition command if not auto control + if (_v_control_mode.flag_control_manual_enabled) { if (_vtol_type->get_mode() == ROTARY_WING) { _transition_command = vehicle_status_s::VEHICLE_VTOL_STATE_MC; diff --git a/src/modules/vtol_att_control/vtol_att_control_main.h b/src/modules/vtol_att_control/vtol_att_control_main.h index 6cf1926a9c..27bcc6ec7f 100644 --- a/src/modules/vtol_att_control/vtol_att_control_main.h +++ b/src/modules/vtol_att_control/vtol_att_control_main.h @@ -43,6 +43,7 @@ * @author Thomas Gubler * @author David Vorsin * @author Sander Smeets + * @author Andreas Antener * */ #ifndef VTOL_ATT_CONTROL_MAIN_H