From f9aa12eaa99509efa54f7cea316f52c0206eaab1 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 12 Dec 2019 14:07:26 +0100 Subject: [PATCH] navigator: don't allow Land together with RTL item This is a check to protect a user from upload a mission which includes a land_start marker as well as a RTL mission item. This works around the problem that we experienced where the navigator would switch to mission mode on RTL and start with land_start, and then continue to the RTL item. At this point, navigator would send the vehicle_command for RTL to commander which would deny it because it is already in RTL mode. Thus navigator won't (re)set any items to actually do RTL and it means the vehicle will just head to whatever setpoint it received last. --- src/modules/navigator/mission_feasibility_checker.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/navigator/mission_feasibility_checker.cpp b/src/modules/navigator/mission_feasibility_checker.cpp index 3d48b53a55..7f997584f8 100644 --- a/src/modules/navigator/mission_feasibility_checker.cpp +++ b/src/modules/navigator/mission_feasibility_checker.cpp @@ -505,6 +505,13 @@ MissionFeasibilityChecker::checkFixedWingLanding(const mission_s &mission, bool mavlink_log_critical(_navigator->get_mavlink_log_pub(), "Mission rejected: starts with land waypoint."); return false; } + + } else if (missionitem.nav_cmd == NAV_CMD_RETURN_TO_LAUNCH) { + if (land_start_found && do_land_start_index < i) { + mavlink_log_critical(_navigator->get_mavlink_log_pub(), + "Mission rejected: land start item before RTL item not possible."); + return false; + } } }