# Understanding Euler Angles and Gimbal Lock

I have been reading that gimbal lock occurs when two axes of rotation become aligned, in an Euler representation of orientation. I am having difficulty understanding what this means in practice, and I have two questions:

1) Let's say I want an aeroplane to rotate from its current orientation to a target orientation. With the Euler representation, it is commonly explained that this rotation occurs about each local axis, one after the other. For example, by first rotating about the local X axis, then about the local Y axis, and then about the local Z axis. And then gimbal lock can occur when two of these axes become aligned during these rotations. But when an aeroplane rotates from one orientation to another, it doesn't do this in three orthogonal motions. It doesn't move a bit around one axis, then a bit around another, and then a bit around another. It just moves smoothly between the two orientations (more like an axis-angle representation), all in one motion. Therefore, I don't understand why any two axes might become aligned. If the aeroplane actually move about each axis, one after the other, then I can see how moving about one axis by 90 degrees would then align the other axes. But this doesn't happen in practice, the robot moves about all three axes at the same time. What am I missing?

2) As well as rotating about the local axes, I have also read that a rotation can be described by rotating about the fixed global frame. This is often describe as R-P-Y rotation. In this case, since the axes about which rotating is occurring are fixed, then these axes can never become aligned. Therefore, it would be impossible to have gimbal lock. So, why is gimbal lock a problem? Why doesn't everybody just perform rotations about the global frame, therefore avoiding gimbal lock entirely?

Thank you!

## 1 Answer

Even in continuous systems, gimbal lock causes weird issues (if you look at the animation on the Wikipedia page you can see this). The issue of gimble lock isn't inherent with 3D rotations, it's how you do them. If you have systems that can generate rotations along three independent axes, and the way you rotate is through applying combinations (not necessarily discretely, continuously is fine) of these rotations, then you can run into issues.

If you have any background in topology, then the issue arises because treating rotations with 3 angles parametrizes rotations by $$S^1 \times S^1 \times S^1 \cong T^3$$, but the space of rotations is $$\mathbb{R}P^3$$ (or $$SO(3)$$) if you want to think of linear algebra). Unfortunately $$T^3$$ does not cover $$\mathbb{R}P^3$$, so you have degeneracy at a point. Note that quaternion transformations (which come from $$S^3$$) does cover $$\mathbb{R}P^3$$ so you would not run into gimbal lock. But many of our physical systems rotations work by (continuously) rotating about 3 axes.

The video here https://www.youtube.com/watch?v=zc8b2Jo7mno explains some of the interesting things that happen if you move continuously. You have to take a weird path.