AP_Landing: Fix an error when computing the course offset for deepstall

This commit is contained in:
Michael du Breuil 2017-09-22 15:43:13 -07:00 committed by Tom Pittenger
parent 654bb6ffce
commit eb9dd8c5a2

View File

@ -484,7 +484,7 @@ float AP_Landing_Deepstall::predict_travel_distance(const Vector3f wind, const f
float wind_length = MAX(wind_vec.length(), 0.05f); // always assume a slight wind to avoid divide by 0 float wind_length = MAX(wind_vec.length(), 0.05f); // always assume a slight wind to avoid divide by 0
Vector2f course_vec(cosf(course), sinf(course)); Vector2f course_vec(cosf(course), sinf(course));
float offset = course + atan2f(-wind.y, -wind.x) + M_PI; float offset = course - atan2f(-wind.y, -wind.x);
// estimator for how far the aircraft will travel while entering the stall // estimator for how far the aircraft will travel while entering the stall
float stall_distance = slope_a * wind_length * cosf(offset) + slope_b; float stall_distance = slope_a * wind_length * cosf(offset) + slope_b;