[Math] Inverse rotation euler angles

coordinate systemsrotationstransformation

I have three angles representing a rotation (Pitch, roll and yaw). I need the inverse rotation (working on coordinate system transforms).
What I do now is transforming these angle to a rotation matrix (using Rodrigues formula implemented in OpenCV) then calculate the inverse rotation matrix and finally use Rodrigues formula again to get the inverse angles.
With an angle input of

[0; -0.34906585; 3.14159265]

I get as output

[0; -0.3447958920828952; 3.103163028746057]

Which is very similar to the input.
Does this make sense?

Best Answer

So a rotation matrix is always orthonormal, so the transpose of your rotation matrix is the same as your inverse. So if your input point was $\vec v$ and your output point was $\vec v_{rot}$, then you know that (depending on which order you applied the rotations):

$$ \vec v_{rot} = \underbrace{R(\text{yaw}) R(\text{pitch}) R(\text{roll})}_{\text{order matters}}\vec v$$

But when you multiply rotation matrices, you always get a new rotation matrix. So you can write:

$$ R = R(\text{yaw}) R(\text{pitch}) R(\text{roll}) $$

Now, the inverse is:

$$ R^{-1} = R^T = \left(R(\text{yaw}) R(\text{pitch}) R(\text{roll})\right)^T = R(\text{roll})^T R(\text{pitch})^T R(\text{yaw})^T$$

Since you used rodrigues' formula, you got R directly. But the point is that $R^T$ is the inverse of R, so you shouldn't have calculated $R^{-1}$ you should have just used R^T. The reason the answer is not identical is due to numerical error introduced when calculating the inverse of a matrix.

Because you are dealing with floating point numbers, it is very unlikely that you will get EXACTLY the same output after inverting.

Related Question