Conversion of rotation between LH and RH coordinate systems with quaternions

1.3k Views Asked by At

I have been given a system (A) in which X is right, Y is up, and Z is near.

I must convert it to a system (B) in which X is forward, Y is left, and Z is up.

In system B, I am interested in a quaternion given in system A. I would like to convert the rotation represented by the quaternion in system A into the equivalent rotation in system B.

When I simply observe the system A quaternion in system B without changing any axes, yaw is yaw, pitch is roll, and roll is pitch. However, when I switch the Y and X axes, I get strange behavior. When facing north, the system becomes inconsistent. Pitch is pitch when facing north, but pitch is yaw when facing west, pitch is negative pitch when facing south.

I need to switch pitch and roll with each other, but it seems that accomplishing this in quaternion representation is not as simple as switching the x and y axes.

How can I convert from this left-handed coordinate system to my right-handed coordinate system and set my quaternion appropriately?

Please comment if my question is confusing. I'll do my best to clarify.

1

There are 1 best solutions below

0
On

What you need is a reflection and luckily those are still easy with quaternions.

For any unit length quaternion $n$ with real part zero, $n^2=-1$, and the transformation $q\mapsto nqn$ is a reflection in the plane normal to $n$.

If you really do have one coordinate system of one type, and need to convert to the other, you can just use $n=i$ and then find a rotation that aligns the axes.

This does exactly what you think: it reverses the sign of the $x$-axis. Perhaps the thing that you were missing is that they way to reflect vectors with quaternions is different from the way to rotate them.