Why does conversion from quaternions to rotation angles followed by rotation angles to quaternions give different results in Aerospace Toolbox 2.2(R2008b)?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a simple example which converts a quaternion to rotational angles and then reconverts it back to quaternion. The reproduction code is as follows:
q=[1 0 1 0];
[yaw, pitch, roll] = quat2angle(q)
q2 = angle2quat(yaw, pitch, roll)
Output (q2) is [0.7071 0 0.7071 0] whereas the input (q) was [1 0 1 0]. I expected q2 to be same as q.
Akzeptierte Antwort
MathWorks Support Team
am 27 Jun. 2009
This is an expected behavior in Aerospace Toolbox 2.2(R2008b) in the way the quaternion to rotational angle conversion is executed.
When a call is made to QUAT2ANGLE, q is normalized internally using the QUATNORMALIZE function. The input q is changed to qin (q/norm(q)).
However, when a call is made using the ANGLE2QUAT to reconvert the rotational angles back to quaternions, the denormalization is not done. Hence, the output 'q' is does not appear same as input 'q' but it is actually the normalized version of 'q' (qin).
As a workaround, one can denormalize the ouput to match the input.
q=[1 0 1 0];
[yaw, pitch, roll] = quat2angle(q)
q2 = angle2quat(yaw, pitch, roll)
q3 = q2*norm(q);
Output (q3) is now [1 0 1 0] , same as the input (q) was [1 0 1 0].
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Unit Conversions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!