mission: fixed bug in computation of landing altitude

Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
RomanBapst 2020-10-09 13:49:46 +03:00 committed by Lorenz Meier
parent a4a03e86da
commit e0c394a00b
1 changed files with 4 additions and 2 deletions

View File

@ -406,7 +406,8 @@ Mission::find_mission_land_start()
// 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;
_landing_alt = missionitem_prev.altitude_is_relative ? missionitem_prev.altitude +
_navigator->get_home_position()->alt : missionitem_prev.altitude;
return true;
// if no DO_LAND_START marker available, also check for VTOL_LAND or normal LAND
@ -418,7 +419,8 @@ Mission::find_mission_land_start()
_land_start_index = i;
_landing_lat = missionitem.lat;
_landing_lon = missionitem.lon;
_landing_alt = missionitem.altitude;
_landing_alt = missionitem.altitude_is_relative ? missionitem.altitude + _navigator->get_home_position()->alt :
missionitem.altitude;
return true;
}
}