diff --git a/src/lib/FlightTasks/tasks/Auto/FlightTaskAuto.cpp b/src/lib/FlightTasks/tasks/Auto/FlightTaskAuto.cpp index 51b4b3aee2..c117d6b668 100644 --- a/src/lib/FlightTasks/tasks/Auto/FlightTaskAuto.cpp +++ b/src/lib/FlightTasks/tasks/Auto/FlightTaskAuto.cpp @@ -178,10 +178,12 @@ bool FlightTaskAuto::_evaluateTriplets() } else { tmp_target(0) = _lock_position_xy(0); tmp_target(1) = _lock_position_xy(1); - _lock_position_xy.setAll(NAN); } } else { + // reset locked position if current lon and lat are valid + _lock_position_xy.setAll(NAN); + // Convert from global to local frame. map_projection_project(&_reference_position, _sub_triplet_setpoint->get().current.lat, _sub_triplet_setpoint->get().current.lon, &tmp_target(0), &tmp_target(1));