# How can a plane or an object gimbal lock itself?

I've been trying to work out some rudimentary dead-reckonings with an IMU chip, and most of the kinetics/kinematics and algorithms are borrowed from aviation related textbooks. I understand what the Euler angles are, how the rotation matrix originates from a dot product between frames, or how to convert my Euler angles to Quaternion to run the algorithm etc. But I just couldn't understand gimbal lock at all.

There are plenty of resources on the web (e.g. Matthew Brett's Gimbal Lock, J.Gallifent's Gimbal Lock, and most notably this YouTube video Euler (gimbal lock) Explained) and a good number of related if not identical questions on SE (most related if not practically identical questions Euler Angles - Gimbal lock, why non-orthogonal axes Gimbal lock confusion and Euler-angles-and-gimbal-lock). Even If I can follow the math derivation, I could not make any qualitative sense or visualization of the concept if the object is not mounted on a gimbal or rings (why would I ever want to mount a plane or an IMU on a gimbal anyway).

The basis of any frame $$(\mathbf{i},\mathbf{j},\mathbf{k})$$ is always orthogonal, and each of the three rotation matrices in $$R_x(\phi)_2^3R_y(\theta)_1^2R_z(\psi)_0^1$$ transform the basis all together, from one frame to another. In between or throughout the three rotation transformations, the basis stays orthogonal - the nose always points in the $$+\mathbf{i}$$ direction, the right wing to $$+\mathbf{j}$$ and belly of the plane faces the $$+\mathbf{k}$$ direction. No order of rotation and not one value of $$\psi, \theta, \text{or } \phi$$ can possibly align $$\mathbf{i}$$ to $$\mathbf{j}$$, or $$\mathbf{j}$$ to $$\mathbf{k}$$.

The only ways to align two axis to satisfy the condition needed for gimbal lock is to mechanically deform the object, such as bending the nose $$90^{\circ}$$ around the $$y$$-axis to align $$\mathbf{i}$$ and $$\mathbf{k}$$, or chopping off both wings and attaching them to the nose to align $$\mathbf{i}$$ and $$\mathbf{j}$$. But that's just non-sense.

I think I'm in need of a qualitative answer or an example of a plane gimbal locking itself to understand what gimbal lock is. Or correct me if I have an entirely erroneous concept of gimbal lock.

[EDIT]

Adding a quote from my textbook Small Unmanned Aircraft Theory and Practice by R. Beard (p.15-16):

The rotation sequence ψ-θ-φ is commonly used for aircraft and is just one of several Euler angle systems in use. The physical interpretation of Euler angles is clear and this contributes to their widespread use. Euler angle representations, however, have a mathematical singularity that can cause computational instabilities. For the ψ-θ-φ Euler angle sequence, there is a singularity when the pitch angle θ is ±90 deg, in which case the yaw angle is not defined. This singularity is commonly referred to as gimbal lock.

You didn’t offer a quote from whatever text mislead you, but from a series of comments it appears that your question is based on a simple misunderstanding.

Aircraft and other objects cannot gimbal lock. The only thing that is capable of being gimbal locked is a gimbal itself.

Aircraft use gimbal mounted gyros for inertial navigation and attitude reference. The gimbal is required to allow the gyro to remain level relative to surface of the earth. These gimbals may lock up during certain aggressive maneuvers.

• Appreciated. I have yet to fully comprehend some of the details but at least I think I know now what my problem is. Coming from a background with no practical knowledge (or common sense) in aviation, I see an IMU or navigation unit in general as a chip mounted on a PCB. How could then a piece of circuit board behaves like rings on a gimbal? .... until I looked into some of the videos and saw what's inside an attitude meter - there are real spinning gyros and gimbal like frame!
– KMC
Commented Nov 15, 2022 at 1:41
• @KMC, You are most welcome! Lots of planes do still have spinning mechanical gyros. It's pretty cool and they still work. Glad I could help, and I hope my poking at you a bit was taken in the spirit it was intended. (I removed my DV by the way...) Commented Nov 15, 2022 at 1:51

When you measure angle in Euler angles (yaw/pitch/roll a.k.a. pan/tilt/roll) you are imagining that the object is mounted in these gimbals and then you are measuring the angles of the imaginary gimbals.

If the imaginary gimbals line up in a gimbal lock way, it can cause a high rate of change to the Euler angles which can cause numerical errors akin to the ones caused by a real gimbal not being able to move quickly enough.

The extreme example is when the pitch and roll axes line up exactly. Imagine that you are looking straight forward, then you tilt your head back and look straight up, then you keep tilting it in the same direction (breaking your neck) and you look straight backwards. When you pass through the straight up direction, your yaw and roll instantly flip 180°. Computations involving derivatives of yaw or roll may throw a fit. If you pass nearby that direction but not straight through it, you will not see an instant flip but a very rapid change. If you are looking straight up, small deviations, e.g. caused by sensor inaccuracy, can result in very large numerical changes to your measured angle.

• Everthing make sense ONLY if I, as you said, imagine a plane is mounted on a gimbal . But why do I want to imagine there to be a gimbal in the first place? The plane has no rings. Its nose(roll), belly(yaw) and wings(pitch) stays orthogonal to each other all the time and so is each individual rotation caused by the Euler angle
– KMC
Commented Nov 12, 2022 at 1:57
• @KMC Because that's what Euler angles are. Euler angles are imaginary gimbals. If you use rotation matrices or quaternions for processing, then you don't imagine gimbals and you don't have gimbal lock. Commented Nov 12, 2022 at 2:22
• In this case, I guess I'm not understanding how the Euler angles relate to a gimbal. Mathematically I think I do if I plug in a 90deg to one angle and zero out a term, but not qualitatively or the intuition. Euler angles suppose to rotate the entire frame with its basis which stays orthogonal throughout. It doesn't rotate like a gimbals where all three rings doesn't necessarily rotate together. So I still don't see how Euler angle mechanically relate to a gimbal. They are just two different things.
– KMC
Commented Nov 12, 2022 at 2:39
• When a inner gimbal ring rotates, the outer ring doesn't. But when the first Euler rotation rotates, all three axis rotate...
– KMC
Commented Nov 12, 2022 at 2:42
• @KMC they are interlinked in physical sense (sorry for layman terms), but as a simplified model, any movement around any axis will not ever limit movement around any other axis. IRL this is of course different beacuse of aerodynamics, gravity etc., but again, in comparison to a gimball, there is no condition that will link movements around any two or three axis in a manner that would lock them together preventing free movement. I'm afraid I'm not able to communicate what I see as self evident by intuition here. Commented Nov 12, 2022 at 11:27

Your aircraft will only gimbal lock if you treat it as if it were a gimbal. That is, you would consecutively rotate it around each one of its three axes until it has been rotated around all three.

Numerical gimbal lock means that you first rotate around one axis, then around another, and by happenstance this is a rotation around 90° which aligns the third axis with the direction of the first (in the global axis system that does not rotate) such that the third rotation will only allow a movement which has already been performed by the first rotation (again, in the global reference system). This removes the freedom to rotate around all three axes freely, because the first and the last rotation could be summed up in a single rotation. This is equivalent to a reduction in the degrees of freedom by one, and just the same as with a gimbal of which two axes of rotation align.

I hope you will agree that aircraft do not rotate in this way in real life.

• To your last sentence, I agree that aircraft do not rotate this way in real life, but you are implying that if you were able to perform a series of aerobatic maneuvers in the way you describe that the aircraft itself would gimbal lock. Is that the intent of your answer? Commented Nov 14, 2022 at 16:18
• @MichaelHall No, not really. You cannot restrict rotation of a real thing to a single axis at a time the way you do when doing an Euler angle transformation. That is my point. Commented Nov 14, 2022 at 16:38
• But you are saying that an aircraft "will" gimbal lock if you were to treat it as if it's a gimbal. How is this possible? Commented Nov 14, 2022 at 17:40
• @MichaelHall If you fix it into rings with bearings (huge rings, admittedly) like a gimbal, which when their axes are lined up will restrict its degrees of freedom, then yes, it will gimbal lock. Commented Nov 14, 2022 at 22:50
• Ok, maybe this is a matter of semantics, but it seems to me that only the gimbal itself can lock, and not the object in the gimbal. I get your point, it just seems this answer is playing into the misunderstanding at the root of the question. (that some object other than a gimbal can lock up...) Commented Nov 15, 2022 at 17:08

The phrase "gimbal lock," as your textbook uses it, doesn't really have anything to do with gimbals (except metaphorically). Your textbook uses the phrase "gimbal lock" to refer to a situation where small changes in attitude result in large changes in Euler angles.

Suppose that an airplane is flying due north, straight and level. The heading is 0°, the pitch is 0°, and the bank is 0°. Then the airplane pitches up by 89.9 degrees. At this point, nothing weird happens: the heading is still 0°, the pitch is 89.9°, and the bank is still 0°.

Now suppose that the airplane pitches up by another 0.2 degrees. The Euler angles change dramatically! The nose of the airplane is now pointing south rather than north, and the airplane's belly, rather than its roof, is above the horizon. As a result, the heading is now 180°, the pitch is still 89.9°, and the bank is now 180°. A mere 0.2 degree change in attitude caused both the heading and the bank to change by 180 degrees!

That's the phenomenon which your textbook calls "gimbal lock." There aren't actually any gimbals, and nothing is actually locking, but weird things are happening with the numbers. The reason that this is called "gimbal lock" is that the mathematical formulas that describe what's happening here are the exact same mathematical formulas that describe real gimbal lock.

As you would imagine, gimbal lock in this sense doesn't actually affect the aircraft itself in any way whatsoever. It's an artifact of the way that we do calculations related to aircraft; it's not an event that actually physically happens.

Solid-state and MEMS gyroscopes aren't physically affected by gimbal lock either. (Your IMU chip probably contains a MEMS gyroscope.) But if the software on them is incorrectly written, then it may malfunction.

(By the way, you might have noticed that we could avoid the dramatic "flip" above by saying that the heading is still 0°, the pitch is now 90.1°, and the bank is still 0°. But now suppose that, starting from north-straight-and-level, the airplane pitches up 89.9 degrees, then it pitches up 0.1 degrees and yaws right 0.1 degrees. Now the heading is 90°, the pitch is 89.9°, and the bank is 90°. There's no way to avoid the sudden 90 degree change in heading and bank.)

• Onto the last paragraph, if the North-heading airplane pitches twice $89.9^{\circ} + 0.1^{\circ}$ the nose (or the x-axis) points straight up and after the last $0.1^{\circ}$ yaw, the plane's belly faces due North and its nose East. Either the heading or the pitch can be $90^{\circ}$ and the bank would be $0^{\circ}$. Why is the pitch $89.9^{\circ}$ and the bank $90^{\circ}$?
– KMC
Commented Dec 5, 2022 at 1:16
• @KMC Pitch is the angle between the nose and the horizon. If the plane had yawed 90°, the nose would be on the horizon, giving a pitch of 0%; but since the plane yawed by only 0.1%, the pitch is 89.9°. The only way to have a pitch of 90° is to have the nose pointing exactly straight up. Commented Dec 5, 2022 at 10:27
• @KMC Bank angle is the amount that the aircraft would have to roll in order to bring the wings level with the belly facing down rather than up. After the plane pitches up 90° and then yaws right 0.1°, the wings are no longer level: the left wing is 0.1° above the horizon and the right wing is 0.1° below the horizon. In order for the plane to bring its wings level again by rolling, it would have to roll 90°. Commented Dec 5, 2022 at 10:29
• @ Tanner - reinstate LGBT people, aha! This answer along with the comments is gold! I guess why weird things can happen then has to do with how the instrumentations are mechanically design or if they are sensed and processed numerically the fixed X->Y->Z ordered rotations can interpret one small change as big rotation around the other axis. Hence we need to apply a different set of Euler order or move on to quaternions. I was having a hard time disassociating a plane from a gimbal, then to relate the math to what is physically measured, but I think I'm getting the picture now.
– KMC
Commented Dec 7, 2022 at 1:40