reset the position lock only if current triplet latitude and longitude

are valid
This commit is contained in:
Martina Rivizzigno
2019-06-12 14:21:16 -04:00
committed by Daniel Agar
parent 0c110a4443
commit 413acc57be
@@ -178,10 +178,12 @@ bool FlightTaskAuto::_evaluateTriplets()
} else { } else {
tmp_target(0) = _lock_position_xy(0); tmp_target(0) = _lock_position_xy(0);
tmp_target(1) = _lock_position_xy(1); tmp_target(1) = _lock_position_xy(1);
_lock_position_xy.setAll(NAN);
} }
} else { } else {
// reset locked position if current lon and lat are valid
_lock_position_xy.setAll(NAN);
// Convert from global to local frame. // Convert from global to local frame.
map_projection_project(&_reference_position, map_projection_project(&_reference_position,
_sub_triplet_setpoint->get().current.lat, _sub_triplet_setpoint->get().current.lon, &tmp_target(0), &tmp_target(1)); _sub_triplet_setpoint->get().current.lat, _sub_triplet_setpoint->get().current.lon, &tmp_target(0), &tmp_target(1));