mission: when land start marker present, look for loiter to altitude item

instead of using the previous waypoint as landing target
- the previous waypoint could be miles away

Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
RomanBapst 2020-10-23 10:32:27 +03:00 committed by Lorenz Meier
parent e0c394a00b
commit 12875f7869
1 changed files with 10 additions and 8 deletions

View File

@ -398,16 +398,18 @@ Mission::find_mission_land_start()
break;
}
// first check for DO_LAND_START marker
if ((missionitem.nav_cmd == NAV_CMD_DO_LAND_START) && (missionitem_prev.nav_cmd == NAV_CMD_WAYPOINT)) {
if (missionitem.nav_cmd == NAV_CMD_DO_LAND_START) {
_land_start_available = true;
_land_start_index = i;
// the DO_LAND_START marker contains no position sp, so take them from the previous mission item
_landing_lat = missionitem_prev.lat;
_landing_lon = missionitem_prev.lon;
_landing_alt = missionitem_prev.altitude_is_relative ? missionitem_prev.altitude +
_navigator->get_home_position()->alt : missionitem_prev.altitude;
}
if (_land_start_available && (missionitem.nav_cmd == NAV_CMD_LOITER_TO_ALT)) {
// use the loiter to altitude item of the mission landing as target landing location
_landing_lat = missionitem.lat;
_landing_lon = missionitem.lon;
_landing_alt = missionitem.altitude_is_relative ? missionitem.altitude +
_navigator->get_home_position()->alt : missionitem.altitude;
return true;
// if no DO_LAND_START marker available, also check for VTOL_LAND or normal LAND