"Unity Programming" Euler angle and Gimbal deadlock (graphic version)

Source: Internet
Author: User

Universal Joint Deadlock (Gimbal lock) problem

As mentioned above, the regulation of Euler's rotation and the definition of axial direction naturally create the problem of "universal joint deadlock". This paper mainly explores the causes of its natural formation.

Gyroscope

First, let's see what gimbal is. Here is a quote from Wikipedia about Gimbal:

The Balance ring (English: Gimbal) is a hub-and-spoke device that enables an object to rotate on a single axis. A group of three balance rings made up of vertical pivot shafts of each other can maintain the axis of rotation of the object in the most inner ring, and is applied to the use of gyro, compass and beverage cup holder on board, and is not affected by the fluctuation of the hull and the hull steering.

is a gimbal device, it is a gyroscope. There is a vertical axis in the middle, passing through a metal disc. The metal disc is called the rotor, and the vertical axis is called the axis. The rotor is made of metal, which should increase the mass and thus increase the inertia. The outer side of the vertical axis is a three-layer nested ring that crosses each other, bringing three degrees of freedom of rotation.
Look at the constant wandering, a little dizzy, next look at two static. These two pictures are from Baidu Encyclopedia.

Chinese notes:

The gimbal, which represents only the balance ring in the gyroscope device, is clearly interpreted as a "balance ring" on Wikipedia.

Pitch, Yaw, Roll

Before explaining how the gyroscope works, let me introduce some rotational terminology. In the voyage of the aircraft, the rotation of the XYZ three-direction rotation has professional terminology, see:

Rotate along the right axis of the fuselage (+x in Unity), called pitch, and Chinese is called pitch .
Rotate along the upper axis of the head (+y in Unity), called Yaw, and Chinese is called Yaw .
Rotate along the front axis of the head (+z in Unity), called roll, and Chinese is called Barrel .

How the Gyroscope works

We know that gyroscopes use to measure the balance and speed of the tool, when the carrier high-speed rotation, the gyroscope always through self-regulation, so that the rotor to maintain the original balance, this is how to do? With this problem, let's take a look at how this ancient and mysterious device works.

To explain the problem clearly, I drew a simple gyroscope myself. (The metal disc I have omitted, ugly a bit also leave.) )

Here, I marked three gimbal rings in different colors, three axes at the bottom, and RGB for XYZ, respectively.
Suppose now that this gyroscope is placed on a ship, the direction of the bow along the +z axis, that is, in front of the right.

    • Now it is assumed that the hull has been shaken, which is the wobble that rotates along the front, that is, the barrel roll. As the rotor and the rotating shaft have a large inertia, as long as there is no direct application of torque, it will maintain the original posture. Due to the flexible rotation of the joint in the green activity, a relative rotation occurs, resulting in the following situation:

    • Again, the hull has been pitch shaken, that is, the pitch. Similarly, due to the relative rotation of the connecting head (Red Connector) in the corresponding direction, the rotor and rotation axis will remain balanced, such as:

    • Finally, it is assumed that the hull has a yaw wobble, which is yaw, when the hull rotates horizontally. The relative rotation occurs in the blue connection header. Such as:

Finally, in the case of pitch, Yaw and roll of the hull, the gyroscope can be adjusted by itself, while the rotor and the rotating shaft are balanced.

Universal joint deadlock in a gyroscope

Now it seems that the gyroscope is all right, and shaking in any direction in the hull can be done by self-regulation. But is that really the case?

If the hull has undergone drastic changes, the bow is raised at 90 degrees (this is the rhythm of the capsized ...). ), at which time the gyroscope regulates the state as:

At this point, the hull rotates again, along the +z axis of the current world coordinates (the blue axis should be pointing to the bottom of the boat) to see what happens.

Now that the rotor is unbalanced, the kick of the gyroscope does not work. It loses its ability to regulate. So what is this for?
Previously, the gyroscope was able to maintain its balance through its own adjustment because there was a connection head that could be rotated relatively. In this case, there is no longer a connection header that can be rotated relatively.
What about the connection head? Where did it go? Obviously, it is still there, except that the relative direction that the connector can be rotated is not what is needed now in the direction of the +z axis. From this, we clearly see:

    • Red Connection head: can give a relative pitch degree of freedom.
    • Green Connection head: can give a relative yaw degree of freedom.
    • Blue Connection head: can give a relative yaw degree of freedom.

Yes, the three connection heads, which provide only two degrees of freedom for pitch and yaw, are lost in barrel roll degrees of freedom. This is the "universal joint deadlock" problem on the gyroscope.

Using small programs to reproduce the deadlock problem of universal joints

First, preset the next Euler angle Change Order. See:

, a list of the parts within the red box that records the growth process of the next Euler angle. That is, it changes from (0,0,0) to (90,0,0), then to (90,90,0), then changes to (90,180,0), then changes to (90,180,90), and then changes to (90,180,180). is a process demonstration of change.

Now you can see:
-The yourselves performs an x-axis rotation of 90 degrees, at which point the pitch (pitch) changes.
-Change 0-180 degrees on the y-axis, at which point the roll (barrel) changes relative to itself.
-Change the z-axis by 0-180 degrees, while still performing a roll (barrel) change relative to itself.

In this case, the pitch, barrel roll, yaw are relative to their own local coordinate system. This is the same as the problem in the gyroscope above, universal joint deadlock. That is, although the Euler angle is precession (continuously increasing or decreasing) on XYZ three axes, it affects the final result only two axes.

Process parsing of deadlock

In the article "Unity in Central Europe" I mentioned that Euler's angular alignment and the definition of axial direction, creating a "universal joint deadlock" problem of the natural formation. Through the above example, here is a detailed explanation.

First we know that because of the definition of the unity Central European pull rotation, the precession around the z-axis is first executed, so the z-axis is a "strict protection" of an axis, that is, when the yourselves along the z-axis, regardless of what the XY is, the final result, the precession around the z-axis always results in a barrel roll change relative
However, the x and Y axes are different, we don't consider the y-axis, assuming it's always 0, say x-axis first. If the z-axis is also maintained at 0, then the final effect is the expected pitch change around the x-axis precession. Such as:

However, when the z-axis is 90 degrees, the movement around the x-axis becomes a yaw change, such as:

That is, the x-axis precession of Euler's angle results in the final change, which is affected by the pre-executed z-axis precession, which still causes some relative self-axial changes, but the result is not unique; Similarly, the y-axis precession of Euler's angle is affected by the z-axis and x-axis, and the result is more unique.

However, the above process is strictly in accordance with the Euler angle of the compliance and axial definition. At some point, this uncertain result may cause the loss of an axial degree of freedom.
Take it for example:

The precession of the z-axis of Euler's angle is first executed, causing the barrel to roll, this is no problem.
The precession of the Euler angle y-axis, which is finally executed, causes the y-axis to rotate along the Euler's rotation, which is also performed according to the definition. Now, however, this rotation along the y-axis is also mapped to the change in barrel roll of the object.

Summarize

In conclusion, the "gimbal deadlock" problem of Euler's angle is caused by the definition of the euro-pull rotation itself. The rotation of the first z, x, and y rotations around the selected rotation front fixed axis is not necessarily a one-to-one mapping with the result that the three axes that are expected to be rotated are not. In some cases, many-to-one mappings cause some loss of rotational degrees of freedom, which is known as "deadlock."

Suggestions

For writing code, it is obviously inappropriate for you to change the Euler angle of the transform directly, as you can see from this article, the results are almost unpredictable. However, in some cases, it can be expected that you are only in one axial precession, the other two axes remain 0, at this time effective, and directly modify the Euler angle code efficiency should be relatively high.

"Unity Programming" Euler angle and Gimbal deadlock (graphic version)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.