4
$\begingroup$

Given a certain coordinate frame, I can compute a new one by applying a set of rotations in a given order (what I call Euler $Z-Y-X$). So I yaw, then pitch then roll.

Now imagine that I want to do exactly the opposite: given two coordinate frames (same origin to simplify), how do I find out roll, pitch and yaw angles that were used to transform from one to the other?

  • 3
    Writing the new unit vectors in terms of the old gives you the rotation matrix. The conversion between the rotation matrix and Euler angles is covered here: http://en.wikipedia.org/wiki/Rotation_representation_%28mathematics%29#Conversion_formulae_between_representations2010-10-12
  • 0
    How do you write the new unit vectors in terms of the old ones? Is it just arcsines? Does order matter? BTW: Why you didn't reply as an answer? It does sound like one to me.2010-10-12
  • 0
    I took your "given two coordinate frames" to mean that you could write down new coordinates in terms of old ones. What did you mean? Knowing how only one point is transformed is not enough to recover the rotation.2010-10-12
  • 0
    Oh, ok. Yes, I only know the new system in terms of the old one. Thanks!2010-10-12
  • 0
    Cmon, go to wikipedia and lookup rotation matrices. There is a link to extract euler angles from a 3x3 rot. matrix. What is your rot. matrix? $E = {\hat{i},\hat{j},\hat{k}}$ where i,j,k are the unit vectors of one coordinate system expressed on the other system.2011-09-27

1 Answers 1

1

The details will vary according to what you mean exactly by yaw, pitch, roll. But here is a general way of transforming the axes. It may not be the best theoretical way to do it, but it works fine computationally.

Let rotations about the $X$-axis by an angle $\theta$ be denoted by $R_{X,\theta}$, and similarly for the other axes. A frame is then obtained by $$T_{\theta,\phi,\psi}:=R_{X,\phi}R_{Y,\theta}R_{Z,\psi}$$

If I understand your question correctly, you want the three angles that would give $T_1T_2^{-1}$ given two frames $T_1$, $T_2$.

  1. Calculate the matrix $S:=T_1T_2^{-1}$
  2. Calculate $\phi=\arctan_2(S_{3,3},-S_{2,3})$, $\theta=\arctan_2(\sqrt{S_{1,1}^2+S_{1,2}^2},S_{1,3})$, $\psi=\arctan_2(S_{1,1},-S_{1,2})$.

Then $\theta$, $\phi$, and $\psi$ are the required angles. Here $\arctan_2(x,y)$ is the modified arctan function that gives the angle in the correct quadrant.

Note that there may be different values of $\phi$, $\theta$, $\psi$ that give the same transformation $S$.