Upcoming SlideShare
×

# Coordinate system transformation

2,659 views

Published on

2 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
2,659
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
53
0
Likes
2
Embeds 0
No embeds

No notes for slide

### Coordinate system transformation

1. 1. Chapter 3Coordinate SystemTransformations3.1 Problem StatementWe have met the various coordinate systems that will be of primary interestin the study of ﬂight dynamics. Now we address the subject of how thesecoordinate systems are related to one another. For instance, when we beginto sum the external forces acting on the aircraft, we will have to relate allthese forces to a common reference frame. If we take some body-axis systemto be the common frame, then we need to be able to take the gravity vector(weight) from the local horizontal reference frame, the thrust from some otherbody-axis frame, and the aerodynamic forces from the wind-axis frame, andrepresent all these forces in the body-axis frame. Some of these relationships are easy because they are ﬁxed: Two body-axis systems, once deﬁned, are always related by a single rotation aroundtheir common y axis. Others are much more complicated because they varywith time: The orientation of a given body-axis system with respect to thewind axes determines certain aerodynamic forces and moments which changethat orientation. First we must characterize the relationship between two coordinate sys-tems at some frozen instant in time. The instantaneous relationship betweentwo coordinate systems will be addressed by determining a transformationthat will take the representation of an arbitrary vector in one system andconvert it to its representation in the other. 23
2. 2. 24 CHAPTER 3. COORDINATE SYSTEM TRANSFORMATIONS Three approaches to ﬁnding the needed transformations will be presented.The ﬁrst is called Direction Cosines, a sort of brute-force approach to theproblem. Next we will discuss Euler angles, by far the most common ap-proach but one with a potentially serious problem. Finally we will examineEuler parameters, an elegant solution to the problem found with Euler angles.3.2 Transformations3.2.1 DeﬁnitionsConsider two reference frames, F1 and F2 , and a vector v whose componentsare known in F1 , represented as {v}1 :    v x1    {v}1 = v  y1    v z1 We wish to determine the representation of the same vector in F2 , or{v}2 :    v x2    {v}2 = v  y2    v z2 These are linear spaces, so the transformation of the vector from F1 toF2 is simply a matrix multiplication which we will denote T2,1 , such that{v}2 = T2,1 {v}1 . Transformations such as T2,1 are called similarity trans-formations. The transformations involved in simple rotations of orthogonalreference frames have many special properties that will be shown. The order of subscripts of T2,1 is such that the left subscript goes with thesystem of the vector on the left side of the equation and the right subscriptwith the vector on the right. For the matrix multiplication to be conformalT2,1 must be a 3x3 matrix:   t11 t12 t13   T2,1 =  t21 t22 t23  t31 t32 t33
3. 3. 3.2. TRANSFORMATIONS 25 x1 x2 y1 z2 v y2 z1 Figure 3.1: Two Coordinate Systems (The tij probably need more subscripting to distinguish them from thosein other transformation matrices, but this gets cumbersome.) The whole point of the three approaches to be presented is to ﬁgure outhow to evaluate the numbers tij . It is important to note that for a ﬁxedorientation between two coordinate systems, the numbers tij are the samequantities no matter how they are evaluated.3.2.2 Direction CosinesDerivationConsider our two reference frames F1 and F2 , and the vector v, shown inﬁgure 3.1. We claim to know the representation of v in F1 . The vector vis the vector sum of the three components vx1 i1 , vy1 j1 , and vz1 k1 so we mayreplace the vector by those three components, shown in ﬁgure 3.2 Now, the projection of v onto x2 is the same as the vector sum of theprojections of each of its components vx1 i1 , vy1 j1 , and vz1 k1 onto x2 , andsimilarly for y2 and z2 . Deﬁne the angle generated in going from x2 to x1 asθx2 x1 . The projection of vx1 i1 onto x2 therefore has magnitude vx1 cos θx2 x1and direction i2 , as shown if ﬁgure 3.3. To the vector vx1 cos θx2 x1 i2 must be added the other two projections,vy1 cos θx2 y1 i2 and vz1 cos θx2 z1 i2 . Similar projections onto y2 and z2 result in:
4. 4. 26 CHAPTER 3. COORDINATE SYSTEM TRANSFORMATIONS x1 x2 y1 z2 v x 1i 1 v y 1j1 y2 z1 v z 1k1 Figure 3.2: Vector in Component Form x1 x2 v x 1i 1 v x 1 cos θ x 2x 1 i 2 θ x 2x 1 Figure 3.3: One Component of the Vector
5. 5. 3.2. TRANSFORMATIONS 27 vx2 = vx1 cos θx2 x1 +vy1 cos θx2 y1 +vz1 cos θx2 z1 vy2 = vx1 cos θy2 x1 +vy1 cos θy2 y1 +vz1 cos θy2 z1 vz2 = vx1 cos θz2 x1 +vy1 cos θz2 y1 +vz1 cos θz2 z1 In vector-matrix notation, this may be written       v x2     cos θx2 x1 cos θx2 y1 cos θx2 z1  vx1     v =  cos θy2 x1 cos θy2 y1 cos θy2 z1  vy1  y2        v z2 cos θz2 x1 cos θz2 y1 cos θz2 z1 v z1 Clearly this is {v}2 = T2,1 {v}1 , so we must have tij = cos θ(axis)2 (axis)1 inwhich i or j is 1 if the corresponding (axis) is x, 2 if (axis) is y, and 3 if(axis) is z.   cos θx2 x1 cos θx2 y1 cos θx2 z1   T2,1 =  cos θy2 x1 cos θy2 y1 cos θy2 z1  (3.1) cos θz2 x1 cos θz2 y1 cos θz2 z1Properties of the Direction Cosine MatrixThe transformation matrix (often called the direction cosine matrix, regard-less of how it is derived or represented) does not depend on the vector v forits existence. It is therefore the same no matter what we choose for v. If wetake    1    {v}1 = 0     0 Then {v}2 is just the ﬁrst column of the direction cosine matrix:    cos θx2 x1    {v}2 = cos θy2 x1     cos θz2 x1
6. 6. 28 CHAPTER 3. COORDINATE SYSTEM TRANSFORMATIONS Since the length of v is 1, we have shown the well-known property ofdirection cosines, that cos2 θx2 x1 + cos2 θy2 x1 + cos2 θz2 x1 = 1 The same obviously holds true for any column of the direction cosinematrix. If we need to go the other way, {v}1 = T1,2 {v}2 , it is clear that T1,2 = −1T2,1 , and we might be tempted to invert the direction cosine matrix. On theother hand, had we begun by assuming {v}2 was known, and ﬁguring outhow to get {v}1 = T1,2 {v}2 using similar arguments to the above, we wouldhave arrived at       v x1    cos θx1 x2 cos θx1 y2 cos θx1 z2  vx2      v =  cos θy1 x2 cos θy1 y2 cos θy1 z2  vy2  y1        v z1 cos θz1 x2 cos θz1 y2 cos θz1 z2 v z2 Here we observe that cos θx1 x2 is the same as cos θx2 x1 , cos θx1 y2 is thesame as cos θy2 x1 , etc., since (even if we had deﬁned positive rotations ofthese angles) the cosine is an even function. So the same transformation is       v x1    cos θx2 x1 cos θy2 x1 cos θz2 x1  vx2      v =  cos θx2 y1 cos θy2 y1 cos θz2 y1  vy2  y1        v z1 cos θx2 z1 cos θy2 z1 cos θz2 z1 v z2 Obviously the columns of T1,2 are the rows of T2,1 (and have unit lengthas well). This leads us to another nice property of these transformation ma-trices, that the inverse of the direction cosine matrix is equal to its transpose, −1 T T1,2 = T2,1 = T2,1 −1 Since T2,1 T2,1 = T2,1 T2,1 = I3 , the 3 × 3 identity matrix, it must be true Tthat the scalar (dot) product of any row of T2,1 with any other row must −1 Tbe zero. It is easy to show that T1,2 T1,2 = T1,2 T1,2 = I3 , so the scalar (dot)product of any column of T2,1 with any other column must be zero since the
7. 7. 3.2. TRANSFORMATIONS 29columns of T2,1 are the rows of T1,2 . When the rows (or columns) of thedirection cosine matrix are viewed as vectors, this means the rows (or thecolumns) form orthogonal bases for 3-dimensional space. T Also, with T2,1 T2,1 = I3 , if we take the determinant of each side and notethat T2,1 = |T2,1 |, we have T T2,1 T2,1 = |T2,1 | T2,1 T T = |T2,1 | |T2,1 | = |T2,1 |2 = 1 The only conclusion we can reach at this point is that |T2,1 | = ±1. Be-cause the identity matrix is a transformation matrix with determinant +1,and since all other transformations may be reached through continuous rota-tions from the identity transformation, it seems unreasonable to think thatthe sign of the determinant would be diﬀerent for some rotations and notothers. We will show in our discussion of Euler angles that the right answeris indeed |T2,1 | = +1. While we have 9 variables in T2,1 = {tij } , i, j = 1 . . . 3, there are 6nonlinear constraining equations based on the orthogonality of the rows (orcolumns) of the matrix. For the rows these are: t2 + t2 + t2 = 1 11 12 13 t21 + t22 + t2 = 1 2 2 23 t31 + t32 + t2 = 1 2 2 33 t11 t21 +t12 t22 +t13 t23 = 0 t11 t31 +t12 t32 +t13 t33 = 0 t21 t31 +t22 t32 +t23 t33 = 0 The result of these constraints is that there are only 3 independent vari-ables. In principle all nine may be derived given any three that do not violatea constraint.3.2.3 Euler anglesIf there are only three independent variables in the direction cosine matrix,then we should be able to express each of the tij in terms of some set of three
8. 8. 30 CHAPTER 3. COORDINATE SYSTEM TRANSFORMATIONS x1 θz x′ y1 θz y′ z1 = z′ Figure 3.4: Rotation Through θz(not necesarily unique) independent variables. One means of determiningthese variables is by use of a famous theorem due to the Swiss mathematicianLeonhard Euler (1707-83). Brieﬂy, this theorem holds that any arbitrarilyoriented reference frame may be placed in alignment with (made to have axesparallel to) any other reference frame by three successive rotations about theaxes of the reference frame. The order of selection of axes in these rotationsis arbitrary, but the same axis may not be used twice in succesion. Therotation sequences are usually denoted by three numbers, 1 for x, 2 for y,and 3 for z. The twelve valid sequences are 123, 121, 131, 132, 213, 212,231, 232, 312, 313, 321, and 323. The angles through which these rotationsare performed (deﬁned as positive according to the right hand rule for righthanded coordinate systems) are called generically Euler angles. The rotation sequence most often used in ﬂight dynamics is the 321, orz − y − x. Considering a rotation from F1 to F2 the ﬁrst rotation (ﬁgure 3.4)is about z1 through an angle θz which is positive according to the right handrule about the z1 axis. With two rotations to go, the resulting alignment ingeneral is oriented with neither F1 or F2 , but some intermediate referenceframe (the ﬁrst of two) denoted F . Since the rotation was about z1 , z isparallel to it but neither of the other two primed axes is. The next rotation (ﬁgure 3.5) is through an angle θy about the axis yof the ﬁrst intermediate reference frame to the second intermediate referenceframe, F . Note that y = y , and neither y or z are necessarily axes ofeither F1 or F2 .
9. 9. 3.2. TRANSFORMATIONS 31 x″ θy x′ θy y″ = y′ z″ z′ Figure 3.5: Rotation Through θy The ﬁnal rotation (ﬁgure 3.6) is about x through angle θx and the ﬁnalalignment is parallel to the axes of F2 . Now assuming we know the angles θx , θy , and θz we need to relate themto the elements of the direction cosine matrix T2,1 . We will do this by seeinghow the arbitrary vector v is represented in each of the intermediate and ﬁnalreference frames in terms of its representation in the prior reference frame. Consider ﬁrst the rotation about z1 (Figure 3.7). In terms of the direc-tion cosines previously deﬁned, the angles between the axes are as follows:between z1 and z it is zero; between either z and any x or y it is 90 deg;between x1 and x or y1 and y it is θz ; between x1 and y it is 90 deg +θz ;and between y1 and x it is 90 deg −θz . We therefore may write
10. 10. 32 CHAPTER 3. COORDINATE SYSTEM TRANSFORMATIONS x″ = x 2 θx y″ z2 θx z″ y2 Figure 3.6: Rotation Through θx x1 x′ θz v x ′i′ vx i1 v v y 1j 1 y1 θz v y ′j′ y′ Figure 3.7: Rotation from F1 to F
11. 11. 3.2. TRANSFORMATIONS 33       vx    cos θx x1 cos θx y1 cos θx z1  vx1      v = cos θy x1 cos θy y1 cos θy z1  vy1  y        vz cos θz x1 cos θz y1 cos θz z1 v z1    cos θz cos (90 deg −θz ) cos 90 deg  vx1      = cos (90 deg +θz ) cos θz cos 90 deg  vy1     cos 90 deg cos 90 deg cos 0 v z1    cos θz sin θz 0  vx1      = − sin θz cos θz 0  vy1     0 0 1 v z1 In short, {v} = TF ,1 {v}1 in which   cos θz sin θz 0   TF ,1 =  − sin θz cos θz 0  (3.2) 0 0 1 From the rotation about y we get {v} = TF ,F {v} in which   cos θy 0 − sin θy   TF ,F = 0 1 0  (3.3) sin θy 0 cos θy From the rotation about x , ﬁnally, {v}2 = T2,F {v} with   1 0 0   T2,F =  0 cos θx sin θx  (3.4) 0 − sin θx cos θx We now cascade the relationships: {v}2 = T2,F {v} , {v} = TF ,F {v}to arrive ﬁrst at {v}2 = T2,F TF ,F {v} and then at {v}2 = T2,F TF ,F TF ,1 {v}1 ,or
12. 12. 34 CHAPTER 3. COORDINATE SYSTEM TRANSFORMATIONS     1 0 0 cos θy 0 − sin θy cos θz sin θz 0    {v}2 =  0 cos θx sin θx   0 1 0   − sin θz cos θz 0  {v}1 0 − sin θx cos θx sin θy 0 cos θy 0 0 1 The transformation matrix we seek is the product of the three sequentialtransformations (in the correct order!), or T2,1 = T2,F TF ,F TF ,1 . The detailsare slightly tedious, but the result is   cos θy cos θz cos θy sin θz − sin θy    sin θx sin θy cos θz sin θx sin θy sin θz   sin θx cos θy  T2,1 =  − cos θx sin θz + cos θx cos θz      cos θx sin θy cos θz cos θx sin θy sin θz  cos θx cos θy + sin θx sin θz − sin θx cos θz Since this is just a diﬀerent way of representing the direction cosine ma-trix, it must be true that cos θy cos θz = cos θx2 x1 , cos θy sin θz = cos θx2 y1 ,etc. At this point we may observe that since T2,1 = T2,F TF ,F TF ,1 , we musthave |T2,1 | = |T2,F TF ,F TF ,1 | = |T2,F | |TF ,F | |TF ,1 | The determinant of each of the three intermediate transformations is eas-ily veriﬁed to be +1, so that we have the expected result, |T2,1 | = +1 It is very important to note that the Euler angles θx , θy , and θz have beendeﬁned for a rotation from F1 to F2 using a 321 rotation sequence. Thus, a321 rotation from F2 to F1 (T1,2 ) with suitably deﬁned angles (say, φx , φy ,and φz ) would have the same form as given for T2,1 , but the angles involvedwould be physically diﬀerent from those in T2,1 . So, for the rotation from F1to F2 using a 321 rotation sequence:
13. 13. 3.2. TRANSFORMATIONS 35   cos φy cos φz cos φy sin φz − sin φy    sin φx sin φy cos φz sin φx sin φy sin φz   sin φx cos φy T1,2 =  − cos φx sin φz + cos φx cos φz      cos φx sin φy cos φz cos φx sin φy sin φz  cos φx cos φy + sin φx sin φz − sin φx cos φz −1 T Alternatively we may note that T1,2 = T2,1 = T2,1 and may write thematrix   sin θx sin θy cos θz cos θx sin θy cos θz  cos θy cos θz   − cos θx sin θz + sin θx sin θz    T1,2 =  cos θ sin θ sin θx sin θy sin θz cos θx sin θy sin θz    y z   + cos θx cos θz − sin θx cos θz  − sin θy sin θx cos θy cos θx cos θy The two matrices are the same, only the deﬁnitions of the angles arediﬀerent. Clearly the relationships among the two sets of angles are non-trivial. In short, the deﬁnitions of Euler angles are unique to the rotation sequenceused and the decision as to which frame one goes from and which one goesto in that sequence. We will normally deﬁne our Euler angles going in onlyone direction using a 321 rotation sequence, and rely on relationships like −1 TT1,2 = T2,1 = T2,1 to obtain the other.3.2.4 Euler parametersThe derivation of Euler parameters is at appendix A. They are based on theobservation that any two coordinate systems are instantaneously related bya single rotation about some axis that has the same representation in eachsystem. The axis, called the eigenaxis, has direction cosines ξ, ζ, and χ; theangle of rotation is η. Then, with the deﬁnition of the Euler parameters
14. 14. 36 CHAPTER 3. COORDINATE SYSTEM TRANSFORMATIONS . q0 =cos (η/2) . q1 =ξ sin (η/2) . (3.5) q2 =ζ sin (η/2) . q3 =χ sin (η/2)the transformation matrix becomes:   (q0 + q1 − q2 − q3 ) 2 2 2 2 2 (q1 q2 + q0 q3 ) 2 (q1 q3 − q0 q2 )   T2,1 =  2 (q1 q2 − q0 q3 ) (q0 − q1 + q2 − q3 ) 2 2 2 2 2 (q2 q3 + q0 q1 )  2 (q1 q3 + q0 q2 ) 2 (q2 q3 − q0 q1 ) (q0 − q1 − q2 + q3 ) 2 2 2 2 (3.6) Euler parameters have one great disadvantage relative to Euler angles:Euler angles may in most cases be easily visualized. If one is given values ofθx , θy , and θz it is not hard to visualize the relative orientation of two coordi-nate systems. A given set of Euler parameters, however, conveys almost noinformation about how the systems are related. Thus even in applicationsin which Euler parameters are preferred (such as in ﬂight simulation), theresults are very often converted to Euler angles for ease of interpretation andvisualization. The direct approach to convert a set of Euler parameters to the corre-sponding set of Euler angles is to equate corresponding elements of the tworepresentations of the transformation matrix. We may combine the (2,3) and(3,3) entries to obtain sin θx cos θy 2 (q2 q3 + q0 q1 ) = tan θx = 2 cos θx cos θy q0 − q1 − q2 + q 3 2 2 2 t23 2 (q2 q3 + q0 q1 ) θx = tan−1 = tan−1 , −π ≤ θx < π t33 2 q0 − q 1 − q 2 + q3 2 2 2 From the (1,3) entry we have − sin θy = 2 (q1 q3 − q0 q2 )
15. 15. 3.2. TRANSFORMATIONS 37 θy = − sin−1 (t13 ) = − sin−1 (2q1 q3 − 2q0 q2 ) , −π/2 ≤ θy ≤ π/2 Finally we use the (1,1) and (1,2) entries to yield cos θy sin θz 2 (q1 q2 + q0 q3 ) = tan θz = 2 cos θy cos θz q 0 + q 1 − q2 − q 3 2 2 2 t12 2 (q1 q2 + q0 q3 ) θz = tan−1 = tan−1 , 0 ≤ θz ≤ 2π t11 2 q0 + q 1 − q2 − q3 2 2 2 With the arctangent functions one has to be careful to not divide byzero when evaluating the argument. Most software libraries have the two-argument arctangent function which avoids this problem and helps keep trackof the quadrant. In summary, θx = tan−1 2(q2 q3 +q0 q1 ) q0 −q1 −q2 +q3 2 2 2 2 , −π ≤ θx < π θy = − sin−1 (2q1 q3 − 2q0 q2 ) , −π/2 ≤ θy ≤ π/2 (3.7) θz = tan−1 2(q1 q2 +q0 q3 ) q0 +q1 −q2 −q3 2 2 2 2 , 0 ≤ θz ≤ 2π Going the other way, from Euler angles to Euler parameters, has beenstudied extensively. It may be done in a somewhat similar manner to equat-ing elements of the transformation matrix. Another more elegant methoddue to Junkins and Turner 1 yields a very nice result, here presented withoutproof: q0 = cos (θz /2) cos (θy /2) cos (θx /2) + sin (θz /2) sin (θy /2) sin (θx /2) q1 = cos (θz /2) cos (θy /2) sin (θx /2) − sin (θz /2) sin (θy /2) cos (θx /2) (3.8) q2 = cos (θz /2) sin (θy /2) cos (θx /2) + sin (θz /2) cos (θy /2) sin (θx /2) q3 = sin (θz /2) cos (θy /2) cos (θx /2) − cos (θz /2) sin (θy /2) sin (θx /2) 1 Junkins, J.L. and Turner, J.D., “Optional Continuous Torque Attitude Maneuvers,”AIAA-AAS Astrodynamics Conference, Palo Alto, California, August 1978.
16. 16. 38 CHAPTER 3. COORDINATE SYSTEM TRANSFORMATIONS Just one ﬁnal note on Euler parameters. Frequently in the literatureEuler parameters are referred to as quaternions. However, quaternions areactually deﬁned as half-scalar, half-vector entities in some coordinate system ˜as Q = q0 + q1 i + q2 j + q3 k. The algebra of quaternions is useful for provingtheorems regarding Euler parameters, but will not be used in this course.3.3 Transformations of Systems of EquationsSuppose we have a linear system of equations in some reference frame F1 : {y}1 = A1 {x}1 We know the transformation to F2 (T2,1 ) and wish to represent the sameequations in that reference frame. Each side of {y}1 = A1 {x}1 is a vector inF1 , so we transform both sides as T2,1 {y}1 = {y}2 = T2,1 A1 {x}1 . Then we Tmay insert the identity matrix in the form of T2,1 T2,1 in the right hand sideto yield {y}2 = T2,1 A1 T2,1 T2,1 {x}1 . The reason for doing this is to transform Tthe vector {x}1 to {x}2 = T2,1 {x}1 . Grouping terms we have the result, {y}2 = T2,1 A1 T2,1 {x}2 = A2 {x}2 T With the conclusion that the transformation of a matrix A1 from F1 toF2 (or the equivalent operation performed by A1 in F2 ) is given by T A2 = T2,1 A1 T2,1 (3.9) This is sometimes spoken of as the transformation of a matrix. Suchtransformations may be very useful. For example, if we could ﬁnd F2 andT2,1 such that A2 is diagonal, then the system of equations {y}2 = A2 {x}2is very easy to solve. The original variables can then be recovered by {y}1 =T2,1 {y}2 , {x}1 = T2,1 {x}2 . T T
17. 17. 3.4. CUSTOMS AND CONVENTIONS 393.4 Customs and Conventions3.4.1 Names of Euler anglesSome transformation matrices occur frequently, and the 321 Euler anglesassociated with them are given special symbols. These are summarized asfollows: TF2 ,F1 θx θ y θz TB,H φ θ ψ (3.10) TW,H µ γ χ TB,W 0 α −β3.4.2 Principal Values of Euler anglesThe principal range of values of the Euler angles is ﬁxed largely by conventionand may vary according to the application. In this course the convention is −π≤θx < π −π/2≤θy ≤ π/2 (3.11) 0≤θz < 2π These ranges are most frequently used in ﬂight dynamics, although occa-sionaly one sees −π < θz ≤ π and 0 < θx ≤ 2π.