Takeoff - allow publishing NAN longitude and latitude

A NAN is interpreted in the FlightTaskAuto as a non-valid global coordinate and sets a local position.
If a zero is sent instead, the global coordinate is recognized as valid and will be executed.
This is a problem when the global position is gained for the first time after takeoff and that a valid global reference did not exist before
This commit is contained in:
bresch
2019-09-10 17:28:56 +02:00
committed by Mathieu Bresciani
parent 549a962553
commit 67e528ec0c

View File

@@ -139,10 +139,10 @@ Takeoff::set_takeoff_position()
pos_sp_triplet->current.yaw = rep->current.yaw; pos_sp_triplet->current.yaw = rep->current.yaw;
} }
if (PX4_ISFINITE(rep->current.lat) && PX4_ISFINITE(rep->current.lon)) { // Set the current latitude and longitude even if they are NAN
pos_sp_triplet->current.lat = rep->current.lat; // NANs are handled in FlightTaskAuto.cpp
pos_sp_triplet->current.lon = rep->current.lon; pos_sp_triplet->current.lat = rep->current.lat;
} pos_sp_triplet->current.lon = rep->current.lon;
// mark this as done // mark this as done
memset(rep, 0, sizeof(*rep)); memset(rep, 0, sizeof(*rep));