Example: tourism industry

A Tutorial on Euler Angles and Quaternions

A Tutorial on Euler Angles and QuaternionsMoti Ben-AriDepartment of Science TeachingWeizmann Institute of 2014 17 by Moti work is licensed under the Creative Commons Attribution-ShareAlike UnportedLicense. To view a copy of this license, send a letter to Creative Commons, 444 Castro Street, Suite 900, MountainView, California, 94041, 1 IntroductionYou sitting in an airplane at night, watching a movie displayed on the screen attachedto the seat in front of you. The airplane gently banks to the left. You may feel the slightacceleration, but you won t see any change in the position of the movie screen. Both youand the screen are in the sameframe of reference, so unless you stand up or make anothermove, the position and orientation of the screen relative to your position and orientationwon t change.

2.1 Cartesian and polar coordinates A vector or a position (the tip of the vector) in a two-dimensional space can be given either in cartesian coordinates (x,y) or in polar coordinates (r,f), relative to a frame of reference: f r y x The formulas for transforming one representation to another are: x = r cosf y = r sinf r = q x2 +y2 f = tan 1 y x.

Tags:

  Glean, Coordinates, Tutorials, Euler, Polar, Quaternion, Polar coordinates, Tutorial on euler angles and quaternions

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of A Tutorial on Euler Angles and Quaternions

1 A Tutorial on Euler Angles and QuaternionsMoti Ben-AriDepartment of Science TeachingWeizmann Institute of 2014 17 by Moti work is licensed under the Creative Commons Attribution-ShareAlike UnportedLicense. To view a copy of this license, send a letter to Creative Commons, 444 Castro Street, Suite 900, MountainView, California, 94041, 1 IntroductionYou sitting in an airplane at night, watching a movie displayed on the screen attachedto the seat in front of you. The airplane gently banks to the left. You may feel the slightacceleration, but you won t see any change in the position of the movie screen. Both youand the screen are in the sameframe of reference, so unless you stand up or make anothermove, the position and orientation of the screen relative to your position and orientationwon t change.

2 The same is not true with respect to your position and orientation relativeto the frame of reference of the earth. The airplane is moving forward at a very high speedand the bank changes your orientation with respect to the transformation of coordinates (position and orientation) from one frame of referenceis a fundamental operation in several areas: flight control of aircraft and rockets, move-ment of manipulators in robotics, and computer graphics. This Tutorial introduces themathematics of rotations using two formalisms: (1) Euler anglesare the Angles of rotationof a three-dimensional coordinate frame. A rotation of Euler Angles is represented as amatrix of trigonometric functions of the Angles .

3 (2)Quaternionsare an algebraic structurethat extends the familiar concept of complex numbers. While Quaternions are much lessintuitive than Angles , rotations defined by Quaternions can be computed more efficientlyand with more stability, and therefore are widely Tutorial assumes an elementary knowledge of trigonometry and matrices. The compu-tations will be given in great detail for two reasons. First, so that you can be convincedof the correctness of the formulas, and, second, so that you can learn how to do themyourselves, in case you come across a context that uses different definitions or a comprehensive presentation of Quaternions using vector algebra, see: John for Computer Graphics, 2011, 2 Rotations in two dimensionsWe start by discussing rotations in two dimensions.

4 The concepts and formulas should befamiliar and a review will facilitate learning about rotations in three Cartesian and polar coordinatesA vector or a position (the tip of the vector) in a two-dimensional space can be giveneither in cartesian coordinates (x,y)or in polar coordinates (r, ), relative to a frame ofreference: ryxThe formulas for transforming one representation to another are:x=rcos y=rsin r= x2+y2 =tan Rotating a vectorSuppose now that the vector is rotated by the angle : ryx ry x 2 The new vector s polar coordinates are(r, + )and its cartesian coordinates can becomputed using the trigonometric identities for the sum of two Angles :x =rcos( + )=r(cos cos sin sin )= (rcos )cos (rsin )sin =xcos ysin ,y =rsin( + )=r(sin cos +cos sin )= (rsin )cos + (rcos )sin =ycos +xsin =xsin +ycos.

5 The transformation of the position(x,y)to(x ,y )caused by a rotation through the angle can be expressed in matrix notation as:[x y ]=[cos sin sin cos ][xy].ExampleLetr=1 and let both and be 30 so that:x=rcos =cos =cos =cos 30 = 3/2y=rsin =sin =sin =sin 30 =1/2 .We can now compute the values ofx andy :[x y ]=[ 3/21/2 1/2 3/2][ 3/21/2]=[( 3/2)2 (1/2)21/2 3/2+1/2 3/2]=[1/2 3/2].The result makes sense since + =60 . A geometric derivation of the rotation matrixThe rotation matrix can be derived geometrically. Rather than look at the vector, let uslook at itsxandycomponents and rotate them (counterclockwise) by (Figure ).Thex- andy- components are rotated by the angle so that theO ABbecomesO A B .Construct two right triangles: (1) Drop the perpendicular fromA to thex-axis to formthe right triangle4O A C; (b) Construct a line throughA parallel to thex-axis and a linethroughB parallel to they-axis.

6 They intersect atC to form the right triangle4B A C .SinceA C is parallel toCO,6C A O=6A OC= .6O A B is a right angle and4A B C is a right triangle so6A B C = . The sides of the two right triangles are labeled with3 Oxcos AB= (x,y) xA yB = (x ,y ) 90 C Cxsin ysin ycos Figure : Geometric derivation of the rotation matrixtheir lengths obtained by trigonometry. It is now easy to see thatx is the length ofOCminus the length ofA C and thaty is the length ofC A plus the length ofC B :x =xcos ysin y =xsin +ycos . Rotating the frame of referenceThe effect of rotating a vector by is the same as the effect obtained by rotation of theframe of reference. The left diagram below shows a vector in the frame of referenceA.

7 Theright diagram shows the same vector after frameAis rotated relative to a new r(xA,yA)xByB r(xA,yA),(xB,yB)xA yAGiven the coordinates (xA,yA)of the points in the frameA:xA=rcos yA=rsin ,4what are its coordinates (xB,yB)in the frameB? The geometry of this diagram is the sameas the geometry of the diagram in Section , so we can use the same equation:[xByB]=[cos sin sin cos ][xAyA].( )ExampleConsider the point(xA,yA) = ( 3/2, 1/2)in frameA. What are the coordinates of thepoint in frameB? As before, the computation gives:[xByB]=[ 3/21/2 1/2 3/2][ 3/21/2]=[1/2 3/2]. Multiple rotationsRotate the coordinate frameBby relative to a new r(xA,yA),(xB,yB),(xC,yC)xB yBxA yAIf we know(xB,yB), we can multiply it by the rotation matrix for to obtain(xC,yC).

8 Let us denote the rotation matrix from frameAto frameBbyRBAand the rotation matrixfrom frameBto frameCbyRCB. GivenpA, the coordinates of a point in frameA, itscoordinates in frameBarepB=RBApA, andpC, its coordinates in frameC, arepC= the two equations we have:pC=RCBpB= This is the rotation matrix fromAtoC, so we can obtain the coordinatespCdirectly frompAby:pC= =30 soRCB=RBA. Then:[xCyC]=[ 3/21/2 1/2 3/2][1/2 3/2]=[01].5 From the drawing we see the vector lies on theyC-axis which corresponds to the coordi-nates(0, 1).Let us now compute:RCA=RCBRBA=[ 3/21/2 1/2 3/2][ 3/21/2 1/2 3/2]=[1/2 3/2 3/21/2].The computationpC=RCApAis:[xCyC]=[1/2 3/2 3/21/2][ 3/21/2]=[01],the same result obtained in the two-stage the vector(1, 0)lying on thex-axis of frameA.

9 RotateAby 15 to frameBandthen rotate frameBby 30 to frameC. Hopefully, the coordinates of the vector in frameCwill be( 2/2, 2/2), because the vector makes an angle of 45 with thex-axis of values of the trigonometric functions for 15 are:cos 15 = 6+ 24, sin 15 6 rotate by 15 :[xByB]=[ 6+ 24 6 24 6 24 6+ 24][10]=[ 6+ 24 6 24].Now rotate by 30 :[xCyC]=[ 3212 12 32][ 6+ 24 6 24]=[ 18+ 28 18+ 28]=[ 22 22].If we multiply the two rotation matrices:[ 6+ 24 6 24 6 24 6+ 24][ 3212 12 32]=[ 22 22 22 22],the result is the rotation matrix for a rotation by 45 .If we multiply the two matrices in the opposite order, we get the same result:[ 3212 12 32][ 6+ 24 6 24 6 24 6+ 24]=[ 22 22 22 22].This shows that rotating by 15 and then by 30 gives the same result as rotating by 30 and then by 15.

10 This is not surprising because we are familiar with the commutativity ofturning knobs clockwise and counterclockwise. Unfortunately, we will not be so luckywhen we discuss three-dimensional 3 Rotations in three dimensionsThe concept of coordinate transformations in three-dimensions is the same as in twodimensions, however, the mathematics are more complicated. Furthermore, many of usfind it difficult to visualize explanations of three-dimensional motion when all we areshown is two-dimensional representations of three-dimensional great eighteenth-century mathematician Leonhard Euler proved that an arbitrarythree-dimensional rotation can be obtained by three individual rotations around the his honor, the Angles of the rotations are calledEuler Rotations around the three axesA two-dimensionalx-ycoordinate frame can be considered to be part of the three-dimensional coordinate frame by adding az-axis perpendicular to thex- is a two-dimensional representation of the three-dimensional coordinate frame.


Related search queries