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.
This commit is contained in:
Julian Oes
2019-12-12 14:07:26 +01:00
committed by Lorenz Meier
parent f8c10b706a
commit f9aa12eaa9
@@ -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;
}
}
}