Friday, March 4, 2011

Gimbal Lock

It's all about degrees of freedom ....

A set of three gimbals mounted together to allow three degrees of freedom. When all three gimbals are lined up (in the same plane), the system can only move in two dimensions from this configuration, not three, and is in gimbal lock. In this case it can pitch or yaw, but not roll (rotate in the plane that the axes all lie in).
Adding a fourth rotational axis can solve the problem of gimbal lock, but it requires the outermost ring to be actively driven so that it stays 90 degrees out of alignment with the innermost axis (the flywheel shaft). Without active driving of the outermost ring, all four axis can become aligned in a plane as shown above, again leading to gimbal lock and inability to roll.

From Wiki:

Gimbal lock is the loss of one degree of freedom in a three-dimensional space that occurs when the axes of two of the three gimbals are driven into a parallel configuration, "locking" the system into rotation in a degenerate two-dimensional space.

The word lock is misleading: no gimbal is restrained. All three gimbals can still rotate freely about their respective axes of suspension. Nevertheless, because of the parallel orientation of two of the gimbal axes there is no axis available to accommodate rotation along one axis.


A gimbal is a ring that is suspended so it c
an rotate about an axis. Gimbals are typically nested one within another to accommodate rotation about multiple axes.

They appear in gyroscopes and in inertial measurement units to allow the inner gimbal's orientation to remain fixed while the outer gimbal suspension assumes any orientation. In compasses, flywheel energy storage mechanisms, or more commonly drink holders, they allow objects to remain upright. They are used to orient thrusters on rockets.[1]

Some coordinate systems in mathematics behave as if there were real gimbals used to measure the angles, notably Euler angles.

For cases of three or fewer nested gimbals, gimbal lock inevitably occurs at some point in the system, due to properties of covering spaces (described below).

Gimbal lock in mechanical engineering

Gimbal lock in two dimensions

Gimbal lock can occur in gimbal systems with two degrees of freedom such as a theodolite with rotations about an azimuth and elevation in two dimensions. These systems can gimbal lock at zenith and nadir, because at those points azimuth is not well-defined, and rotation in the azimuth direction does not change the direction the theodolite is pointing.

Consider tracking a helicopter flying towards the theodolite from the horizon. The theodolite is a telescope mounted on a tripod so that it can move in azimuth and elevation to track the helicopter. The helicopter flies towards the theodolite and is tracked by the telescope in elevation and azimuth. The helicopter flies immediately above the tripod (i.e. it is at zenith) when it changes direction and flies at 90 degrees to its previous course. The telescope cannot track this maneuver without a discontinuous jump in one or both of the gimbal orientations. There is no continuous motion that allows it to follow the target. It is in gimbal lock. So there is an infinity of directions around zenith that the telescope cannot continuously track all movements of a target.[2] Note that even if the helicopter does not pass through zenith, but only near zenith, so that gimbal lock does not occur, the system must still move exceptionally rapidly to track it, as it rapidly passes from one bearing to the other. The closer to zenith the nearest point is, the faster this must be done, and if it actually goes through zenith, the limit of these "increasingly rapid" movements becomes infinitely fast, namely discontinuous.

To recover from gimbal lock the user has to go around the zenith – explicitly: reduce the elevation, change the azimuth to match the azimuth of the target, then change the elevation to match the target.

Mathematically, this corresponds to the fact that spherical coordinates do not define a coordinate chart on the sphere at zenith and nadir. Alternatively, that the corresponding map T2S2 from the torus T2 to the sphere S2 (given by the point with given azimuth and elevation) is not a covering map at these points.

Gimbal lock in three dimensions

Normal situation: the three gimbals are independent

Gimbal lock: two out of the three gimbals are in the same plane, one degree of freedom is lost
Consider a case of a level sensing platform on an aircraft flying due North with its three gimbal axes mutually perpendicular (i.e., roll, pitch and yaw angles each zero). If the aircraft pitches up 90 degrees, the aircraft and platform's Yaw axis gimbal becomes parallel to the Roll axis gimbal, and changes about yaw can no longer be compensated for (see illustration, red ring is pivoted to green ring and green ring is pivoted to blue ring).
The word lock is misleading: no gimbal is restrained, all three gimbals can still rotate freely about their respective axis of suspension. Nevertheless, because of the parallel orientation of both the yaw and roll gimbal axes, there is no axis available to accommodate yaw rotation.


This problem may be overcome by use of a fourth gimbal, intelligently driven by a motor so as to maintain a large angle between roll and yaw gimbal axes. Another solution is to rotate one or more of the gimbals to an arbitrary position when gimbal lock is detected and thus reset the device.

Modern practice is to avoid the use of gimbals entirely. In the context of inertial navigation systems, that can be done by mounting the inertial sensors directly to the body of the vehicle (this is called a strapdown system)[3] and integrating sensed rotation and acceleration digitally using quaternion methods to derive vehicle orientation and velocity. Another way to replace gimbals is to use fluid bearings or a flotation chamber.[4]

Gimbal lock on Apollo 11

A well-known gimbal lock incident happened in the Apollo 11 Moon mission. On this spacecraft, a set of gimbals was used on an inertial measurement unit (IMU). The engineers were aware of the gimbal lock problem but had declined to use a fourth gimbal.[5] Some of the reasoning behind this decision is apparent from the following quote:
"The advantages of the redundant gimbal seem to be outweighed by the equipment simplicity, size advantages, and corresponding implied reliability of the direct three degree of freedom unit."
—David Hoag, Apollo Lunar Surface Journal
They preferred an alternate solution using an indicator that would be triggered when near to 85 degrees pitch.
"Near that point, in a closed stabilization loop, the torque motors could theoretically be commanded to flip the gimbal 180 degrees instantaneously. Instead, in the LM, the computer flashed a 'gimbal lock' warning at 70 degrees and froze the IMU at 85 degrees"
—Paul Fjeld, Apollo Lunar Surface Journal
Rather than try to drive the gimbals faster than they could go, the system simply gave up and froze the platform. From this point, the spacecraft would have to be manually moved away from the gimbal lock position, and the platform would have to be manually realigned using the stars as a reference.[6]
After the Lunar Module had landed, Mike Collins aboard the Command Module joked "How about sending me a fourth gimbal for Christmas?"


Industrial robot operating in a foundry.
In robotics, gimbal lock is commonly referred to as "wrist flip", due to the use of a "triple-roll wrist" in robotic arms, where three axes of the wrist, controlling yaw, pitch, and roll, all pass through a common point.

An example of a wrist flip, also called a wrist singularity, is when the path through which the robot is traveling causes the first and third axes of the robot's wrist to line up. The second wrist axis then attempts to spin 180° in zero time to maintain the orientation of the end effector. The result of a singularity can be quite dramatic and can have adverse effects on the robot arm, the end effector, and the process.

The importance of non-singularities in robotics has led the American National Standard for Industrial Robots and Robot Systems — Safety Requirements to define it as "a condition caused by the collinear alignment of two or more robot axes resulting in unpredictable robot motion and velocities".[7]

Gimbal lock in applied mathematics

The problem of the gimbal lock appears when one uses the Euler angles in an application of mathematics, for example in a computer program (3D modeling, embedded navigation systems, 3D video games, metaverses, ...).
In formal language, gimbal lock occurs because the map from Euler angles to rotations (topologically, from the 3-torus T3 to the real projective space RP3) is not a covering map – it is not a local homeomorphism at every point, and thus at some points the rank (degrees of freedom) must drop below 3, at which point gimbal lock occurs. Euler angles provide a means for giving a numerical description of any rotation in three dimensional space using three numbers, but not only is this description not unique, but there are some points where not every change in the target space (rotations) can be realized by a change in the source space (Euler angles).

This is a topological constraint – there is no covering map from the 3-torus to the 3-dimensional real projective space; the only (non-trivial) covering map is from the 3-sphere, as in the use of quaternions.
To make a comparison, all the translations can be described using three numbers x, y, and z, as the succession of three consecutive linear movements along three perpendicular axes X, Y and Z axes. That's the same for rotations, all the rotations can be described using three numbers α, β, and γ, as the succession of three rotational movements around three axes that are perpendicular one to the next. This similarity between linear coordinates and angular coordinates makes Euler angles very intuitive, but unfortunately they suffer from the gimbal lock problem.

Loss of a degree of freedom with Euler angles

A rotation in 3D space can be represented numerically with matrices in several ways. One of these representations is:
R &= \begin{bmatrix}
\cos \alpha & -\sin \alpha & 0 \\
\sin \alpha & \cos \alpha & 0 \\
0 & 0 & 1 \end{bmatrix} \begin{bmatrix}
1 & 0 & 0 \\
0 & \cos \beta & -\sin \beta \\
0 & \sin \beta & \cos \beta \end{bmatrix} \begin{bmatrix}
\cos \gamma & -\sin \gamma & 0 \\
\sin \gamma & \cos \gamma & 0 \\
0 & 0 & 1 \end{bmatrix} \end{align}
with α and γ constrained in the interval [ − π,π], and β constrained in the interval [0,π].
Let's examine for example what happens when β = 0. Knowing that \cos\, 0 = 1 and \sin \,0 = 0, the above expression becomes equal to:
 R &= \begin{bmatrix}
\cos \alpha & -\sin \alpha & 0 \\
\sin \alpha & \cos \alpha & 0 \\
0 & 0 & 1 \end{bmatrix} \begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1 \end{bmatrix} \begin{bmatrix}
\cos \gamma & -\sin \gamma & 0 \\
\sin \gamma & \cos \gamma & 0 \\
0 & 0 & 1 \end{bmatrix} \end{align}
The second matrix is the identity matrix and has no effect on the product. Carrying out matrix multiplication of first and third matrices:
 R &= \begin{bmatrix}
\cos \alpha \cos \gamma -\sin \alpha \sin \gamma & -\cos \alpha \sin \gamma - \sin \alpha \cos \gamma & 0 \\
\sin \alpha \cos \gamma + \cos \alpha \sin \gamma & -\sin \alpha \sin \gamma + \cos \alpha \cos \gamma & 0 \\
0 & 0 & 1 \end{bmatrix} \end{align}
And finally using the trigonometry formulas:
 R &= \begin{bmatrix}
\cos ( \alpha + \gamma ) & -\sin (\alpha + \gamma) & 0 \\
\sin ( \alpha + \gamma ) & \cos (\alpha + \gamma) & 0 \\
0 & 0 & 1 \end{bmatrix} \end{align}
Changing α's and γ's values in the above matrix has the same effects: the rotation's angle α + γ changes, but the rotation's axis remains in the Z direction. The last column and the last line in the matrix won't change: one degree of freedom has been lost.

The only solution for α and γ to recover different roles is to get β away from the 0 value.
A similar problem appears when β = π.

One can choose another convention for representing a rotation with a matrix using Euler angles than the Z-X-Z convention above, and also choose other variation intervals for the angles, but at the end there is always at least one value for which a degree of freedom is lost.

Note that the gimbal lock problem does not make Euler angles "wrong" (they always play at least their role of a well-defined coordinates system), but it makes them unsuited for some practical applications.

The quaternion solution

Another representation for rotations in 3D space is the quaternions.

A quaternion is a tuple made of 4 numbers (s,\ x,\ y,\ z) that represents a geometrical similarity in the general case. If the relation s2 + x2 + y2 + z2 = 1 is verified, then the quaternion can be used to represent a rotation.
From a practical point of view, a rotation of an angle \mathbf{\theta} around an axis directed by a normalized vector \vec{N} = (x_0, y_0, z_0) is represented by the quaternion
(\cos (\theta / 2),\ x_0 \cdot \sin (\theta / 2),\ y_0 \cdot \sin (\theta / 2),\ z_0 \cdot \sin (\theta / 2) ).\
There is no problem similar to the gimbal lock with quaternions. This can be explained intuitively by the fact that a quaternion describes a rotation in one single move ("please turn \mathbf{\theta} radians around the axis driven by vector \vec{N}"), while the Euler angles are made of three successive rotations.
Besides that, quaternions also have other advantages over Euler angles.

See also


  1. ^ Jonathan Strickland (2008). "What is a gimbal -- and what does it have to do with NASA?". 
  2. ^ Adrian Popa (Thu Jun 4 10:47:03 1998). "Re: What is meant by the term gimbal lock?". 
  3. ^ Chris Verplaetse (1995). "Overview of Pen Design and Navigation Background". 
  4. ^ Chappell, Charles, D. (2006). "Articulated gas bearing support pads". 
  5. ^ David Hoag (1963). "Apollo Guidance and Navigation - Considerations of Apollo IMU Gimbal Lock - MIT Instrumentation Laboratory Document E-1344". 
  6. ^ Eric M. Jones and Paul Fjeld (2006). "Gimbal Angles, Gimbal Lock, and a Fourth Gimbal for Christmas". 
  7. ^ ANSI/RIA R15.06-1999

External links

1 comment:

Jacquelyn Anika said...

It is very good for more information.