I am currently trying to implement a motion model in Extended Kalman Filter that estimate dynamic motion of an object.
In the filter, I have a state of vector including, [position, velocity, quaternion], where the position has the position of x, y, and z, the velocity has the velocity along x, y, and z, and the quaternion has q0, q1, q2, and q3.
To implement time update step, Direct Cosine Matrix(DCM) is generated based on the value of quaternion at time t-1. However, to generate the DCM, I found that there are some varieties of the matrix, such that:
suppose we have quaternion values, q0, q1, q2, q3
1)
R = [[1 - 2*(q2**2 + q3**2), 2*(q1*q2 + q3*q0), 2*(q1*q3 - q2*q0)],
[2*(q1*q2 - q3*q0), 1 - 2*(q1**2 + q3**2), 2*(q2*q3 + q1*q0)],
[2*(q1*q3 + q2*q0), 2*(q2*q3 - q1*q0), 1 - 2*(q1**2 + q2**2)]]
R = [[q0**2 + q1**2 - q2**2 - q3**2, 2*(q1*q2 + q0*q3), 2*(q1*q3 - q0*q2)],
[2*(q1*q2 - q0*q3), q0**2 - q1**2 + q2**2 - q3**2, 2*(q2*q3 + q0*q1)],
[2*(q1*q3 + q0*q2), 2*(q2*q3 - q0*q1), q0**2 - q1**2 - q2**2 + q3**2]]
R = [[q0**2 + q1**2 - q2**2 - q3**2, 2*(q1*q2 - q0*q3), 2*(q1*q3 + q0*q2)],
[2*(q1*q2 + q0*q3), q0**2 - q1**2 + q2**2 - q3**2, 2*(q2*q3 - q0*q1)],
[2*(q1*q3 - q0*q2), 2*(q0*q1 + q2*q3), q0**2 - q1**2 - q2**2 + q3**2]]
Those values are obtained from:
- https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation
- https://se.mathworks.com/help/aeroblks/quaternionstodirectioncosinematrix.html
- https://ahrs.readthedocs.io/en/latest/filters/ekf.html
Is there any factors that determines the choice of DCM, such as system’s coordinate like East-North-Up?
I appreciate your help.