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