mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-02 05:04:08 +08:00
EKF: wrap compass yaw estimate
This commit is contained in:
parent
7d6226eb45
commit
90e1bd3e36
@ -613,6 +613,9 @@ void Ekf::fuseHeading()
|
||||
matrix::Vector3f mag_earth_pred = R_to_earth * _mag_sample_delayed.mag;
|
||||
float measured_yaw = atan2f(mag_earth_pred(1), mag_earth_pred(0)) - _mag_declination;
|
||||
|
||||
// wrap the yaw to the interval between +-pi
|
||||
measured_yaw = matrix::wrap_pi(measured_yaw);
|
||||
|
||||
// calculate the innovation
|
||||
matrix::Euler<float> euler(_state.quat_nominal);
|
||||
float innovation = euler(2) - measured_yaw;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user