FlightTask: use centralized _dist_to_ground computed in FlightTask instead of

recomputing it in AutoMapper, AutoMapper2 and AutoLine
This commit is contained in:
bresch
2019-11-22 09:44:51 +01:00
committed by Matthias Grob
parent 4ba672a7ba
commit 4d0786d5b4
6 changed files with 8 additions and 48 deletions

View File

@@ -164,9 +164,9 @@ void FlightTask::_evaluateVehicleLocalPosition()
void FlightTask::_evaluateDistanceToGround()
{
_dist_to_ground = NAN;
// Altitude above ground is by default just the negation of the current local position in D-direction.
_dist_to_ground = -_position(2);
// if there is a valid distance to bottom or vertical distance to home
if (PX4_ISFINITE(_dist_to_bottom)) {
_dist_to_ground = _dist_to_bottom;