FlightTask: fail activation if required states are not available

This commit is contained in:
Dennis Mannhart
2018-05-22 14:23:58 +02:00
committed by Lorenz Meier
parent e6f6e2085c
commit afd02aca92
8 changed files with 58 additions and 2 deletions
@@ -63,6 +63,14 @@ bool FlightTaskAuto::activate()
_prev_prev_wp = _prev_wp = _target = _next_wp = _position;
_setDefaultConstraints();
// need a valid position and velocity
ret = ret && PX4_ISFINITE(_position(0))
&& PX4_ISFINITE(_position(1))
&& PX4_ISFINITE(_position(2))
&& PX4_ISFINITE(_velocity(0))
&& PX4_ISFINITE(_velocity(1))
&& PX4_ISFINITE(_velocity(2));
return ret;
}