ControlMath: don't consider sign when vector length is 0

This commit is contained in:
Dennis Mannhart 2018-02-19 10:53:15 +01:00 committed by Beat Küng
parent bd37c274c6
commit ec79b2f8c8

View File

@ -154,7 +154,7 @@ void constrainPIDu(matrix::Vector3f &u, bool stop_I[2], const float Ulimits[2],
* since we do not know better. (no direction given)
*/
if (u.length() < 0.0001f) {
u = matrix::Vector3f(0.0f, 0.0f, math::sign(u(2)) * Ulimits[1]);
u = matrix::Vector3f(0.0f, 0.0f, -Ulimits[1]);
} else {
u = u.normalized() * Ulimits[1];