I am trying to understand exactly what is happening when Gimbal lock occurs. I have read many explanations now which provide the high-level idea, in that Gimbal lock occurs when two axes are aligned during the sequence of three rotations. But I am struggling to understand what this really means in terms of the calculations that are going on.

Here's my understanding of the setup. We have an initial 3D rotation of a body, and a target 3D rotation of that body, and we want to move the body from the initial to the target rotation. To do this, we calculate the Euler angles representing this rotation. (I don't know the maths behind this, but I will assume that this is just an algorithm that takes in an initial and target rotation, and returns a third rotation).

So, we now have a rotation expressed as Euler angles, which we want the body to move over. And now I will explain my confusion. From what I have been reading, there are two ideas:

1. Gimbal lock occurs when two of the axes become aligned, during the sequence of three rotations, which means that there is one axis about which rotation cannot occur.
2. Due to Gimbal lock, the path which the rotation occurs over will not be "straight", and there will be a curve.

This to me is very confusing. 1) is saying that Gimbal lock means that we cannot rotate the body along a certain axis. 2) is saying that Gimbal lock means that we can rotate the body, but that the path will not be "straight".

Please can somebody explain which one is correct, and help me to overcome this confusion? Thanks!

Gimbal lock is a specific form of the larger concept of a kinematic singularity when one or more axes of a gimbal become aligned.

A classic gimbal mount has successive semi-circular mounts which can pivot and provide yaw, pitch, and roll degrees of freedom for the gimbal. (If you sort those from outside in yaw, pitch, roll.) If you pitch down, such that the central body is vertical. You will notice that the yaw axis is about vertical, but so is the roll axis, since it rotated 90 degrees down from the X axis. In this configuration if you wanted to rotate the body about the X axis (where the roll joint was originaly pointed) by a little bit, it is impossible because you have two joints vertically aligned along the vertical Z axis (yaw, and formerly roll) and one still along the Y axis.

This is gimbal lock, because your three degrees of freedom system can no longer move in all three directions.

The above explanation is for a physical gimbal. But people refer to this issue as well when using Euler angles because the mathematical construction of Euler angles uses the same representation of sequential yaw, pitch, and roll angle representations. This representation has the same issue as the physical example above.

There's a full description of this on Wikipedia

There are other ways to express this with higher level math such as the jacobian matrix's rank

Specifically to understand the difference that you're seeing between 1) and 2). You could move the vehicle to another position which is close and offset around the axis where you no longer have control. But to get there based on the constraints it won't be a quick move. Aka you will need to move to another position and then back as per the explanation 2). While 1) is saying that you can't move directly towards your goal, which is consistent.

If you're working with simply the math of orientation there are alternative ways to represent position such as quaterions which do not incur these singularities in their representation.

First of all, don't use Euler angles. That's a real nasty thing.

I don't understand 2 without the context but 1 means the following.

If the following is your rotation matrix,

Rotation Matrix = Rotx(x)*Roty(y)*Rotz(z),

Gimbalock means two different rotation matrices R1 and R2 could be the same.

R1 = Rotx(x+10deg)*Rotz(y)*Rotx(z)

R2 = Rotx(x)*Rotz(y+10deg)*Rotx(z)

The following shows a visualization of this problem. https://en.wikipedia.org/wiki/File:Gimbal_Lock_Plane.gif

Obviously, either you change x or y the result is the same and once it happens your control system will go bad.

You don't even need to understand this. Just stay away from Euler angles and use rotation vector representation.

• Or quaternion coordinates. Oct 30, 2021 at 1:53