ekf2: utils add getEulerYaw() that uses the best rotation sequence

This commit is contained in:
Daniel Agar
2022-02-02 08:54:03 -05:00
parent c3e0b93fc8
commit 88ffc177f7
9 changed files with 24 additions and 44 deletions
+1 -3
View File
@@ -187,9 +187,7 @@ void Ekf::resetWind()
*/
void Ekf::resetWindUsingAirspeed()
{
const float euler_yaw = shouldUse321RotationSequence(_R_to_earth)
? getEuler321Yaw(_state.quat_nominal)
: getEuler312Yaw(_state.quat_nominal);
const float euler_yaw = getEulerYaw(_R_to_earth);
// estimate wind using zero sideslip assumption and airspeed measurement if airspeed available
_state.wind_vel(0) = _state.vel(0) - _airspeed_sample_delayed.true_airspeed * cosf(euler_yaw);