AP_WindVane: switch x and y in read_SITL_direction_ef

This commit is contained in:
Randy Mackay 2018-10-07 20:12:10 +09:00
parent 836237cc49
commit ff4ef4968e

View File

@ -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