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

Source: Internet
Author: User

Universal Joint Deadlock (Gimbal lock) problem

As previously mentioned, Euler's rotational compliance and axial definition naturally created the problem of "universal joint deadlock". This paper mainly explores the causes of its natural formation.

Gyroscope

First of all. Let's get to know 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 set of three just-balanced rings made up of each other's vertical pivot shafts. It is possible to maintain the axis of rotation of the object in the frame at the most, and apply it to the gyroscope, compass, beverage cup holder and other uses on the ship, without being 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 and should be added in mass. thus increasing 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 gaze:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvqw5kcmv3rmfu/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "alt=" gyroscope "title=" ">

While gimbal represents only the balance ring in a gyroscope device, it is clear that Wikipedia interprets it as a "balance ring" more reasonable.

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:

/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvqw5kcmv3rmfu/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "alt=" Pitch, Yaw, Roll "title=" ">

Rotate along the right axis of the fuselage (+x in Unity), called pitch. 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, in the rapid rotation of the carrier, the gyroscope will always be self-adjusting, so that the rotor to maintain the original balance. How is this done? With this problem. Let's take a look at how this ancient and magical device works.

To explain the problem clearly, I drew a simple gyroscope myself.

(The metal disk I have omitted, the ugly bit will leave.)

。 )

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvqw5kcmv3rmfu/font/5a6l5l2t/fontsize/200/fill/i0jbqkfcma==/ Dissolve/70/gravity/northeast "alt=" gyroscope "title=" ">
Here, I have three gimbal rings marked with different colors, the bottom three axes, RGB respectively corresponding XYZ.
If the gyroscope is now placed on a ship, the bow is headed along the +z axis. Right in front.

    • Now, If. The hull was shaken, and it was shaking along the front, that is, the barrel roll. Because the rotor and the rotating shaft have greater inertia. Just do not apply the torque directly. Will keep the original posture. Because the medium green active connector is flexible to rotate, a relative rotation occurs, resulting in the following scenario:

    • Again if. The hull was pitch shaken, or pitching. In the same way, the rotor and the rotating shaft remain balanced because there is a corresponding direction for the relative rotation of the connecting head (Red Connector). For example, with:

    • And finally, if. The hull has a yaw wobble, or yaw, when the hull rotates horizontally. The relative rotation occurs in the blue connection header.

      For example, with:

Finally, in the case of pitch, Yaw and roll of the hull, the gyroscope can be adjusted by itself, allowing the rotor to balance the rotating shaft.

Universal joint deadlock in a gyroscope

Now it looks as if the gyroscope is normal and can be adjusted in its own way in the arbitrary direction of the hull.

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 this time the gyroscope regulates the state for example with:

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.

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvqw5kcmv3rmfu/font/5a6l5l2t/fontsize/200/fill/i0jbqkfcma==/ Dissolve/70/gravity/northeast "alt=" Deadlock Gyroscope "title=" ">

Today, the rotor is unbalanced, and the kick of the gyroscope does not work. It loses its ability to regulate. So what is this for?
The gyroscope was able to adjust itself before. Balance is due to the existence of a connection head that can be rotated relatively. In such a case, there is no longer a connection head that can be rotated relatively.
What about the connection head? Where did it go? Obviously, it's still there, and it's just. The relative direction in which the connector can be rotated is not what is now required to be in the +z axis direction. From this, we clearly see:

    • Red Connector: Able to give a relative pitch degree of freedom.
    • Green Connection head: able to give a relative yaw degree of freedom.
    • Blue Connector: Able to give a relative yaw degree of freedom.

Yes, three connection heads, providing a degree of freedom that corresponds only to pitch and yaw two degrees of freedom, the barrel roll freedom is lost. 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:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvqw5kcmv3rmfu/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "alt=" preset Euler rotation "title=" ">

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

Now you can see:
-Yourselves running x-axis rotates at 90 degrees, at which time 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 running relative to its own roll (barrel rolling) changes.

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 in the XYZ three axial precession (continuous growth or decrease), but the effect of the final result, only corresponding to two axial.

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 examples, here is a detailed explanation.

First we know that the precession of the z-axis is the first to run because of the definition of the conformity of the unity Central European pull rotation. Therefore, the z-axis is a "strictly protected" axis. So. Yourselves the precession along the z-axis, regardless of what XY is at this point, the result is that the precession around the z-axis always causes a change in the barrel roll relative to its own run.
However, the x and Y axes are different, we don't consider the y-axis, if it's always 0. Say the x-axis first. If the z-axis is also maintained at 0, then the surrounding x-axis precession, finally the effect is the expected pitch change.

For example, with:

However, when the z-axis is 90 degrees. The surrounding x-axis precession becomes a yaw change, for example by:

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

However, the above process is strictly in accordance with the Euler angle of the compliance and axial definition.

Certain moments, such an indeterminate result. may result in the loss of an axial degree of freedom.


Take it for example:

Precession of the z-axis of the Euler angle. First run, causing the barrel to roll. That's fine.
The precession of the y-axis of Euler's angle, which runs at last, causes the y-axis to rotate along the Euler's rotation, which is also the basis of the definition. Now, however, this rotation follows the y-axis. The same is also mapped to the change in barrel roll of the object.

Summarize

In summary. The "gimbal deadlock" problem of Euler's angle is due to the Euler rotation definition itself. The rotation of the first z, x, and y rotations of the pre-rotating axis is not necessarily a one-to-one mapping, with the result that the three axes that are finally expected to rotate can be rotated. 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 can be seen from this article, such results are almost non-predicted.

However, in some cases, it is possible to expect that you are only in one axial precession, the other two axes remain 0, at this time effective, and directly change 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.