Navigator: land: set lat/lon fields of triplet to NAN if global position is not valid

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2024-10-31 13:34:45 +01:00
committed by Matthias Grob
parent 53dda3576b
commit aa25964942
+9 -2
View File
@@ -827,8 +827,15 @@ MissionBlock::set_land_item(struct mission_item_s *item)
item->nav_cmd = NAV_CMD_LAND;
// set land item to current position
item->lat = _navigator->get_global_position()->lat;
item->lon = _navigator->get_global_position()->lon;
if (_navigator->get_local_position()->xy_global) {
item->lat = _navigator->get_global_position()->lat;
item->lon = _navigator->get_global_position()->lon;
} else {
item->lat = (double)NAN;
item->lon = (double)NAN;
}
item->yaw = NAN;
item->altitude = 0;