From 83e0f479bdb2d6cc610c059647616d0cc4db7167 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Wed, 23 Oct 2024 15:45:27 +0200 Subject: [PATCH] Navigator: land: set lat/lon fields of triplet to NAN if global position is not valid Signed-off-by: Silvan Fuhrer --- src/modules/navigator/mission_block.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/navigator/mission_block.cpp b/src/modules/navigator/mission_block.cpp index 17dd3e620ca2..d5721269b41c 100644 --- a/src/modules/navigator/mission_block.cpp +++ b/src/modules/navigator/mission_block.cpp @@ -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;