This is a thing that puzzles me. I know that when you use Euler angles and apply rotations to objects you have to stick to one axis sequence, for example, XYZ, in order to avoid gimbal lock. My question is the reverse.
Imagine I have quaternions that I want to convert to Euler angles. So, I take all those quaternions and convert to a sequence of rotations to be applied on 3 axis in my object.
These are the questions:
- if I follow conversions like the one shown in this Wikipedia page will I obtain angles that go from -PI to PI in all 3 axis?
- now I have the angles, how do I know which order I should apply to the object?
- do this formulas of Wikipedia imply that I must use a particular axis transformation sequence as XYZ or something?
- is there a different formula for different axis sequences?
what I am looking for are the formulas to convert to the aeronautics notation sequence (see picture)
My math is a little bit rusty, so please don’t make your answer too mathematically exoteric.
thanks in advance.

That’s not entirely right. Not only do you have to stick with a particular axis sequence, you also have to stick with a particular reference frame for the rotations. You would typically hear of body-fixed and global-fixed rotations (the difference between the two is mainly about the order in which the elementary rotations get multiplied) BTW, you will get that same problem when using quaternions. Euler Angles are a family of rotation representations there are basically 12 unique sequences of elementary rotations that you can do to achieve the final rotation matrix. Plus the two possible reference frames, that gives you 24 possible representations that are all referred to as “Euler Angles” (although 12 are redundant). The most usual versions that you find are “3-2-1 body-fixed” and “1-2-3 global” (this are the same), “1-2-3 body-fixed” (inverse sequence), “3-1-3 body-fixed” (very much used in robotics), and finally the Tait-Bryan (“1-(minus)2-3 global-fixed” or “roll-pitch-yaw”). You have to stick to one convention.
Wikipedia is not to be trusted in this matter (try mathworld instead, or a real text-book). On the page you linked to, the formula corresponds to “1-2-3 body-fixed” (at least that is what is said there).
Finally, the “gimbal lock” can never be avoided, they are inherent to any Euler Angles convention, they are unavoidable. If you get a math text-book, you can read on why that is.
No, you will get two of the angles in a range from -Pi to Pi, and one angle from -Pi/2 to Pi/2 (again, that will be the case for all conventions). For the wiki formula, you will get Phi in [-Pi,Pi], Theta in [-Pi/2,Pi/2], and Psi in [-Pi,Pi].
For “1-2-3 body-fixed”, it is x first, then y, then z. Since it is body-fixed, the order of the rotations matrices is indeed Rx Ry Rz. That resulting matrix will be can be used to pre-multiply with a vector whose components are expressed in the coordinate frame of the rotated object, and transform to components expressed in the “global” coordinate frame.
Yes, of course. Every convention has a different formula. This is why, in certain applications, people prefer different conventions because they can sort-of avoid getting near the singular points which correspond to mathematical singularities in the conversion equations. Conventions have different singularities, and sometimes that can be exploited (and avoided) if there is a particular geometry to your system.
Hopefully I didn’t… but 3D rotations aren’t the easiest topic for sure. They get very confusing at times, and you should do it carefully. In my experience, you are always better off sticking with quaternions all the way (with exception of occasional use of rotation matrices when needed).