diff --git a/EKF/ekf_helper.cpp b/EKF/ekf_helper.cpp index f86ca38be3..e4b0bc9b42 100644 --- a/EKF/ekf_helper.cpp +++ b/EKF/ekf_helper.cpp @@ -1596,6 +1596,7 @@ void Ekf::calcExtVisRotMat() // calculate the quaternion delta between the EV and EKF reference frames at the EKF fusion time horizon Quatf q_error = _state.quat_nominal * _ev_sample_delayed.quat.inversed(); q_error.normalize(); + q_error.canonicalize(); // convert to a delta angle and apply a spike and low pass filter Vector3f rot_vec = q_error.to_axis_angle(); @@ -1623,6 +1624,7 @@ void Ekf::calcExtVisRotMat() // convert filtered vector to a quaternion and then to a rotation matrix q_error.from_axis_angle(_ev_rot_vec_filt); q_error.normalize(); + q_error.canonicalize(); _ev_rot_mat = Dcmf(q_error); // rotation from EV reference to EKF reference }