mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 09:51:35 +08:00
EKF: add function to initialise wind states
This commit is contained in:
committed by
CarlOlsson
parent
6dff2df28e
commit
75bec44b94
@@ -215,3 +215,17 @@ void Ekf::get_wind_velocity(float *wind)
|
|||||||
wind[0] = _state.wind_vel(0);
|
wind[0] = _state.wind_vel(0);
|
||||||
wind[1] = _state.wind_vel(1);
|
wind[1] = _state.wind_vel(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reset the wind states using the current airspeed measurement, ground relative nav velocity, yaw angle and assumption of zero sideslip
|
||||||
|
*/
|
||||||
|
void Ekf::resetWindStates()
|
||||||
|
{
|
||||||
|
// get euler yaw angle
|
||||||
|
matrix::Euler<float> euler321(_state.quat_nominal);
|
||||||
|
float euler_yaw = euler321(2);
|
||||||
|
|
||||||
|
// estimate wind assuming zero sideslip
|
||||||
|
_state.wind_vel(0) = _state.vel(0) - _airspeed_sample_delayed.true_airspeed * cosf(euler_yaw);
|
||||||
|
_state.wind_vel(1) = _state.vel(1) - _airspeed_sample_delayed.true_airspeed * sinf(euler_yaw);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user