Browse Source

AP_WindVane: switch x and y in read_SITL_direction_ef

master
Randy Mackay 6 years ago
parent
commit
ff4ef4968e
  1. 8
      libraries/AP_WindVane/AP_WindVane.cpp

8
libraries/AP_WindVane/AP_WindVane.cpp

@ -215,13 +215,13 @@ float AP_WindVane::read_SITL_direction_ef() @@ -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

Loading…
Cancel
Save