Skip to content

Commit

Permalink
Takeoff - allow publishing NAN longitude and latitude
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bresch committed Sep 19, 2019
1 parent 549a962 commit 67e528e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/modules/navigator/takeoff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ Takeoff::set_takeoff_position()
pos_sp_triplet->current.yaw = rep->current.yaw;
}

if (PX4_ISFINITE(rep->current.lat) && PX4_ISFINITE(rep->current.lon)) {
pos_sp_triplet->current.lat = rep->current.lat;
pos_sp_triplet->current.lon = rep->current.lon;
}
// Set the current latitude and longitude even if they are NAN
// NANs are handled in FlightTaskAuto.cpp
pos_sp_triplet->current.lat = rep->current.lat;
pos_sp_triplet->current.lon = rep->current.lon;

// mark this as done
memset(rep, 0, sizeof(*rep));
Expand Down

0 comments on commit 67e528e

Please sign in to comment.