From f771c7ff639f0abb80d7d6a385fc9a5dfadca855 Mon Sep 17 00:00:00 2001 From: thomas Date: Tue, 4 Oct 2022 17:39:38 +0200 Subject: [PATCH] back transition if RTL is called during front transition --- src/modules/navigator/rtl.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/modules/navigator/rtl.cpp b/src/modules/navigator/rtl.cpp index eeb85a497a..8b2efafae7 100644 --- a/src/modules/navigator/rtl.cpp +++ b/src/modules/navigator/rtl.cpp @@ -240,6 +240,15 @@ void RTL::on_activation() { _rtl_state = RTL_STATE_NONE; + // send a back transition command in case we're doing a front transition to abort the FT + if (_navigator->get_vstatus()->in_transition_to_fw) { + vehicle_command_s cmd {}; + cmd.command = vehicle_command_s::VEHICLE_CMD_DO_VTOL_TRANSITION; + cmd.param1 = (float)(vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC); + cmd.param2 = 0.0f; + _navigator->publish_vehicle_cmd(&cmd); + } + // if a mission landing is desired we should only execute mission navigation mode if we currently are in fw mode // In multirotor mode no landing pattern is required so we can just navigate to the land point directly and don't need to run mission _should_engange_mission_for_landing = (_destination.type == RTL_DESTINATION_MISSION_LANDING)