From 197a21a22eea3fcb5afc2084a1bb35ba0f6ca227 Mon Sep 17 00:00:00 2001 From: RomanBapst Date: Tue, 21 Apr 2020 15:56:52 +0300 Subject: [PATCH] rtl: for fixed wing (also vtol) make the descend state of RTL use type NAV_CMD_LOITER_TO_ALT - this allows vtol to track the loiter circle during the transition instead of trying to fly to the landing position Signed-off-by: RomanBapst --- src/modules/navigator/rtl.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/navigator/rtl.cpp b/src/modules/navigator/rtl.cpp index edb6d85f08..7a3f3d4c10 100644 --- a/src/modules/navigator/rtl.cpp +++ b/src/modules/navigator/rtl.cpp @@ -342,7 +342,13 @@ void RTL::set_rtl_item() } case RTL_STATE_DESCEND: { - _mission_item.nav_cmd = NAV_CMD_WAYPOINT; + if (_navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING) { + _mission_item.nav_cmd = NAV_CMD_LOITER_TO_ALT; + + } else { + _mission_item.nav_cmd = NAV_CMD_WAYPOINT; + } + _mission_item.lat = _destination.lat; _mission_item.lon = _destination.lon; _mission_item.altitude = loiter_altitude;