Computer Graphics World

JUNE 09

Issue link: http://digital.copcomm.com/i/1573

Contents of this Issue

Navigation

Page 12 of 51

June 2009 11 Viewpoint n n n n It is fairly easy to get close to gimbal lock: We simply need to rotate the "middle" angle, or gimbal, by 90 degrees. Because two of the rotational axes have become aligned, chang- ing the first or the last angle in the chain re- sults in a rotation around the same axis (see images above). e only way to leave this locked state is to adjust the middle rotation again and move it out of the danger zone. Gimbal Lock in CG Computer animators controlling charac- ters' body parts or any kind of object us- ing only three angular values should try to avoid gimbal lock. Investigate your setup before you start to animate, and change the order of the axes so the middle axis is the least one used. If all three degrees of free- dom are needed, hierarchical transforma- tions (parenting an additional node) may help. If readability and human interac- tion are not important, such as under the hood of game engines, then quaternions and rotational matrices are used instead of Euler angles. Quaternions are four-dimen- sional representations, ideal for computing smooth transitions between poses. While gimbal lock never happens when using quaternions, they are hard to read and con- ceptualize. In spite of all the issues of lock- ing gimbals, Euler angles are the industry standard for describing rotations. Real-world gimbal systems have been known and used for a very long time now. e gyroscope—invented nearly 200 years ago—is a fine example: At the heart of this device is a platform, with one or more spin- ning wheels or disks mounted in gimbals. e large angular momentum of the spin- ning elements forces the central platform to remain almost perfectly fixed, regardless of the motion of the device's "shell," as the gimbals let it rotate freely. By installing sen- sors to detect the rotation of each gimbal, we can measure the relative orientation (or attitude) of any object as it relates to a fixed reference system. at is how the Inertial Measurement Unit (IMU) of air- craft, spacecraft, and watercraft, including guided missiles, works. e three gimbals hold the central stable platform—with the spinning elements—without introducing any notable external torque, which would force the platform to lose its original orien- tation. at is where gimbal lock becomes a real problem: By losing one degree of freedom near this state, the fixed platform cannot rotate freely, thereby risking the loss of reference. is may be a good time to finish read- ing the magazine and begin watching the 1995 movie Apollo 13 featuring Tom Hanks (and some great visual effects). You will be surprised how much they talk, or yell, about avoiding gimbal lock and losing the reference of the Inertial Measurement Unit. e IMU of the Apollo space program was a three-gimbal system, and pilots were required to navigate the spacecraft so they did not approach the 10-degree danger zone around gimbal lock. e current attitude of the vehicle was displayed on the Flight Di- rector Attitude Indicator, or the "eight ball," as pilots referred to it. If the indicator entered the red danger zone centered at yaw 0 and 180-degree poles, and the stable member lost its attitude reference, the gimbals had to be re-aligned in-flight against star references. So, the next time you are fighting gimbal lock in a 3D animation package or game engine, don't panic. Just think of the Apollo 13 crew members, who were losing oxygen and electrical power in a crippled spacecraft at the same time. n A three-gimbal system is analogous to the Euler angles. In the above left image, all the axes are at their default positions. If the middle (red) gimbal is rotated 90 degrees, as seen in the above right image, the blue and the green axes become aligned, losing one degree of freedom.

Articles in this issue

Archives of this issue

view archives of Computer Graphics World - JUNE 09