mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 08:28:52 +08:00
small cleanup for FlightTask::_evaluateDistanceToGround if-else
This commit is contained in:
@@ -188,13 +188,15 @@ void FlightTask::_evaluateVehicleLocalPositionSetpoint()
|
||||
void FlightTask::_evaluateDistanceToGround()
|
||||
{
|
||||
// Altitude above ground is local z-position or altitude above home or distance sensor altitude depending on what's available
|
||||
_dist_to_ground = -_position(2);
|
||||
|
||||
if (PX4_ISFINITE(_dist_to_bottom)) {
|
||||
_dist_to_ground = _dist_to_bottom;
|
||||
|
||||
} else if (_sub_home_position.get().valid_alt) {
|
||||
_dist_to_ground = -(_position(2) - _sub_home_position.get().z);
|
||||
|
||||
} else {
|
||||
_dist_to_ground = -_position(2);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user