EKF: Remove use of of quaternion self product operator and fix delta rotation sign

This commit is contained in:
Paul Riseborough
2019-06-14 10:00:45 +10:00
committed by Paul Riseborough
parent 0e946f25fd
commit a036cf82cc
3 changed files with 9 additions and 11 deletions
+2 -3
View File
@@ -226,12 +226,11 @@ void Ekf::controlExternalVisionFusion()
increaseQuatYawErrVariance(sq(fmaxf(_ev_sample_delayed.angErr, 1.0e-2f)));
// calculate the amount that the quaternion has changed by
_state_reset_status.quat_change = quat_before_reset.inversed() * _state.quat_nominal;
_state_reset_status.quat_change = _state.quat_nominal * quat_before_reset.inversed();
// add the reset amount to the output observer buffered data
// Note q1 *= q2 is equivalent to q1 = q2 * q1
for (uint8_t i = 0; i < _output_buffer.get_length(); i++) {
_output_buffer[i].quat_nominal *= _state_reset_status.quat_change;
_output_buffer[i].quat_nominal = _state_reset_status.quat_change * _output_buffer[i].quat_nominal;
}
// apply the change in attitude quaternion to our newest quaternion estimate