From ff4ef4968ea3654fde4fa6f798f2320731084345 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Sun, 7 Oct 2018 20:12:10 +0900 Subject: [PATCH] AP_WindVane: switch x and y in read_SITL_direction_ef --- libraries/AP_WindVane/AP_WindVane.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/AP_WindVane/AP_WindVane.cpp b/libraries/AP_WindVane/AP_WindVane.cpp index 7bc7692c7e..6b9d8980a7 100644 --- a/libraries/AP_WindVane/AP_WindVane.cpp +++ b/libraries/AP_WindVane/AP_WindVane.cpp @@ -215,13 +215,13 @@ float AP_WindVane::read_SITL_direction_ef() // This is accounted for in these calculations // convert true wind speed and direction into a 2D vector - Vector2f wind_vector_ef(sinf(wind_dir_rad) * wind_speed, cosf(wind_dir_rad) * wind_speed); + Vector2f wind_vector_ef(cosf(wind_dir_rad) * wind_speed, sinf(wind_dir_rad) * wind_speed); // add vehicle speed to get apparent wind vector - wind_vector_ef.x += AP::sitl()->state.speedE; - wind_vector_ef.y += AP::sitl()->state.speedN; + wind_vector_ef.x += AP::sitl()->state.speedN; + wind_vector_ef.y += AP::sitl()->state.speedE; - return atan2f(wind_vector_ef.x, wind_vector_ef.y); + return atan2f(wind_vector_ef.y, wind_vector_ef.x); } #endif