FlightTask: fail activation if required states are not available

This commit is contained in:
Dennis Mannhart
2018-07-20 09:26:18 +02:00
committed by Lorenz Meier
parent e6f6e2085c
commit afd02aca92
8 changed files with 58 additions and 2 deletions
@@ -47,6 +47,9 @@ bool FlightTaskManualAltitude::activate()
_position_setpoint(2) = _position(2);
_velocity_setpoint(2) = 0.0f;
_setDefaultConstraints();
// altitude-mode requires to have a valid position and velocity state in D-direction
ret = ret && PX4_ISFINITE(_position(2)) && PX4_ISFINITE(_velocity(2));
return ret;
}