FlightTaskManualStabilized: allow attitude control with 0 throttle

With minimum throttle set to 0, it was not possible to control the attitude
anymore at 0 throttle, the vehicle would just stay level.
This commit is contained in:
Beat Küng 2018-09-22 09:12:50 +02:00 committed by Lorenz Meier
parent b93d02aee7
commit afada8ddb5
1 changed files with 2 additions and 1 deletions

View File

@ -123,9 +123,10 @@ void FlightTaskManualStabilized::_updateThrustSetpoints()
/* The final thrust setpoint is found by rotating the scaled unit vector pointing /* The final thrust setpoint is found by rotating the scaled unit vector pointing
* upward by the Axis-Angle. * upward by the Axis-Angle.
* Make sure that the attitude can be controlled even at 0 throttle.
*/ */
Quatf q_sp = AxisAnglef(v(0), v(1), 0.0f); Quatf q_sp = AxisAnglef(v(0), v(1), 0.0f);
_thrust_setpoint = q_sp.conjugate(Vector3f(0.0f, 0.0f, -1.0f)) * _throttle; _thrust_setpoint = q_sp.conjugate(Vector3f(0.0f, 0.0f, -1.0f)) * math::max(_throttle, 0.0001f);
} }
void FlightTaskManualStabilized::_rotateIntoHeadingFrame(Vector2f &v) void FlightTaskManualStabilized::_rotateIntoHeadingFrame(Vector2f &v)