From eb9dd8c5a28441a4eb15066b39b35b701942535b Mon Sep 17 00:00:00 2001 From: Michael du Breuil Date: Fri, 22 Sep 2017 15:43:13 -0700 Subject: [PATCH] AP_Landing: Fix an error when computing the course offset for deepstall --- libraries/AP_Landing/AP_Landing_Deepstall.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_Landing/AP_Landing_Deepstall.cpp b/libraries/AP_Landing/AP_Landing_Deepstall.cpp index 201790791b..7974c03492 100644 --- a/libraries/AP_Landing/AP_Landing_Deepstall.cpp +++ b/libraries/AP_Landing/AP_Landing_Deepstall.cpp @@ -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 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 float stall_distance = slope_a * wind_length * cosf(offset) + slope_b;