Why do we use Q^(-1)*R*Q when convert quaternion to dcm

17 vues (au cours des 30 derniers jours)
rodineye mao
rodineye mao le 12 Mai 2016
Commenté : James Tursa le 7 Fév 2020
The function quat2dcm is computed according to Q^(-1)*R*Q, where R is a vector and Q is a quaternion. Why not Q*R*Q^(-1)? Thank you very much for your help.
for example
if true
q1 = [0.9997 -0.0008 -0.0231 -0.0074];
dcm1 = quat2dcm(q1);
R = [34;45;56];
X1 = dcm1*R;
X2 = quatmultiply(quatmultiply(quatinv(q1),[0 R(1) R(2) R(3)]),q1);
X3 = quatmultiply(quatmultiply(q1,[0 R(1) R(2) R(3)]),quatinv(q1));
end
then we can find that X1 is equal to X2, not X3

Réponses (1)

James Tursa
James Tursa le 12 Mai 2016
Modifié(e) : James Tursa le 12 Mai 2016
The Q^(-1)*v*Q is a standard convention that is widely used in industry, but I have encountered the Q*v*Q^(-1) convention as well. E.g., suppose you have three coordinate systems, A, B, and C. And you have dcm and q for transforming between them as follows:
v_A = Vector v expressed in frame A coordinates
v_B = Vector v expressed in frame B coordinates
v_C = Vector v expressed in frame C coordinates
dcm_A2B = Direction Cosine Matrix to transform v_A to v_B
dcm_B2C = Direction Cosine Matrix to transform v_B to v_C
dcm_A2C = Direction Cosine Matrix to transform v_A to v_C
q_A2B = Quaternion to transform v_A to v_B
q_B2C = Quaternion to transform v_B to v_C
q_A2C = Quaternion to transform v_A to v_C
For dcm the situation is:
v_B = dcm_A2B * v_A
v_C = dcm_B2C * v_B
= dcm_B2C * (dcm_A2B * v_A)
= (dcm_B2C * dcm_A2B) * v_A
= dcm_A2C * v_A
That is, for successive rotations the dcm's stack up on the left.
But for the Q^(-1)*v*Q convention we have:
v_B = q_A2B^(-1) * v_A * q_A2B
v_C = q_B2C^(-1) * v_B * q_B2C
= q_B2C^(-1) * (q_A2B^(-1) * v_A * q_A2B) * q_B2C
= q_B2C^(-1) * q_A2B^(-1) * v_A * q_A2B * q_B2C
= (q_A2B * q_B2C)^(-1) * v_A * (q_A2B * q_B2C)
= q_A2C^(-1) * v_A * q_A2C
So, for successive rotations the q's (under this convention) stack up on the right.
In practice I typically run across the Q^(-1)*v*Q convention when rotation quaternions are used, but not always. In particular, the NASA Space Shuttle Orbiter flight software used the opposite Q*v*Q^(-1) convention where successive rotation q's stacked up on the left like dcm's. It is critical to know what convention is being used when working with rotation quaternions (as well as whether the scalar is first or last). You need this info to know how to combine successive rotations, for one. Also, if you need for two systems with different conventions to talk to each other, and you sent a quaternion from one system to the other system, you would need to conjugate it (and maybe change the order of the elements) to get it into the other convention.
  2 commentaires
rodineye mao
rodineye mao le 13 Mai 2016
So I want to know whether the order of Q^(-1)*v*Q or Q*v*Q^(-1) is related to the type of quaternion (Hamilton and JPL), because the Hamilton quaternion is the conjugate of JPL quaternion. Or it only need to pre-determine the order in the system, unlimited of the type of quaternion? Thank you very much.
James Tursa
James Tursa le 13 Mai 2016
In practice, whenever I start working with a new company etc, I always ask them to supply the quaternion along with a corresponding dcm. That is the only way to be sure IMO. You can talk back & forth all you want about conventions, but the same words can mean different things to different people. Until I get some quaternion-dcm matched pairs from them I am never 100% sure I know what their convention is.

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by