mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-26 18:48:30 -04:00
Plane: prevent a float exception at pitch 90
this can happen with a tailsitter
This commit is contained in:
parent
1ad929c56e
commit
9709bca7b4
@ -156,9 +156,11 @@ void Plane::calc_gndspeed_undershoot()
|
||||
Vector2f gndVel = ahrs.groundspeed_vector();
|
||||
const Matrix3f &rotMat = ahrs.get_rotation_body_to_ned();
|
||||
Vector2f yawVect = Vector2f(rotMat.a.x,rotMat.b.x);
|
||||
yawVect.normalize();
|
||||
float gndSpdFwd = yawVect * gndVel;
|
||||
groundspeed_undershoot = (aparm.min_gndspeed_cm > 0) ? (aparm.min_gndspeed_cm - gndSpdFwd*100) : 0;
|
||||
if (!yawVect.is_zero()) {
|
||||
yawVect.normalize();
|
||||
float gndSpdFwd = yawVect * gndVel;
|
||||
groundspeed_undershoot = (aparm.min_gndspeed_cm > 0) ? (aparm.min_gndspeed_cm - gndSpdFwd*100) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user