-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Open
Labels
Description
I am currently studying EKF3 and have discovered a function in the magnetometer fusion section controlMagYawReset()
https://github.com/ArduPilot/ardupilot/blob/aabbe500aa4b682305b3062116edebc3fd0528c6/libraries/AP_NavEKF3/AP_NavEKF3_MagFusion.cpp#L42
Assuming two quaternions are defined as follows:

The product of the two is calculated as follows:



ret.q1 = (rquat0*quat0 + rquat1*quat1 + rquat2*quat2 + rquat3*quat3);
ret.q2 = (rquat0*quat1 - rquat1*quat0 - rquat2*quat3 + rquat3*quat2);
ret.q3 = (rquat0*quat2 + rquat1*quat3 - rquat2*quat0 - rquat3*quat1);
ret.q4 = (rquat0*quat3 - rquat1*quat2 + rquat2*quat1 - `rquat3*quat0);
The quantities of rquat1... rquat3 in ret.q2, ret.q3, and ret.q4 do not seem to be correctly multiplied by a negative sign.