Presentation is loading. Please wait.

Presentation is loading. Please wait.

Making a Point: Elementary (around Z) Rotations in 2D …

Similar presentations


Presentation on theme: "Making a Point: Elementary (around Z) Rotations in 2D …"— Presentation transcript:

1 Making a Point: Elementary (around Z) Rotations in 2D …
Rotation of coordinates Rotation of vector r = |r| = |r1| = |r2| r = |r| r x2 y2 1 x1 y1 cos q - sin q sin q 0 cos q 0 = x2 y2 1 cos q sin q - sin q 0 cos q 0 = x1 y1 By now it should be clear the difference in the two types of rotations. Also, it should be clear that one matrix is the transpose of the other Moreover, that a transpose is the inverse matrix Lastly, that one matrix is obtained from the other by changing the sign of the angle!

2 Making a Point: Rotation Kinematics
If a rigid body B rotates around a given fixed axis, the rotation matrices being: g degrees about the Z-axis of the global frame G, or b degrees about the Y-axis of the global frame G, or a degrees about the X-axis of the global frame G, the corresponding (roll-pitch-yaw angles) rotation matrices are: Rz,g = cos g - sin g sin g 1 RY,b = cos b sin b - sin b RX,a = cos a - sin a sin a x y z However, if the rigid body B does not rotate but the global axes are the ones that are rotating, then the above matrices need to be slightly modified by interchanging their sine term in the matrices. This can be done by: switching the sine terms in the matrices, or changing the sign of the rotation angle, or getting the transpose of the matrices, or getting the inverse of the matrices. all of this is the possible because, as stated much earlier, these are SO(3) – special orthogonal in 3D - matrices! Rz,g = cos g sin g - sin g 1 RY,b = cos b - sin b sin b 1 RX,a = cos a sin a - sin a 1 x y z Lastly, in the textbook these are defined backwards because it uses a row vector pre-multiplying the matrices!!!

3 NOTE ON AN IDENTITY DUE TO EULER.
It is rare the case that you remember a most important identity. Plus calculus professors do not make a big deal regarding this identity. However, it is crucial to explain a lot of advanced features in some engineering and calculus results. eix = cos(x) + i*sin(x), where i2 = -1 In fact, one of Euler’s most celebrated result is to have found that epi = -1 (trivially derived from the expression above for x = p, where cos(p) = -1 ad sin(p) = 0) Moreover, you can see now why Log(-1) = pi. That is, logs have a meaning for negative numbers … In addition, you can explain the existence of arcsine and arccosine of numbers larger than 1. They exist in the realm of complex numbers. That’s all!!! Still, “Beware of complex numbers!” … at our elementary level, we are dealing with Robots in the world of real numbers, not in the world of more sophisticated mathematical entities!

4 SOME MIDTERM ISSUES: PROBLEM # 5
5. The rows of a rotation matrix are [ ], [ ] and [ ]. Find the roll-pitch and yaw angles in degrees. That is the matrix is: [ ] [ ] [ ] Solution: We use the formulas: a = atan2(r32, r33) or atan(r32/r33) b = -asin(r31) g = atan2(r21,r11) or atan(r21/r11) (The answer turned to be “7”, that is None!) Serious problem to be highlighted! … r31 = !!! and for any angle y sine satisfies: |sin(y)|  1.

5 SOME MIDTERM ISSUES: PROBLEM # 9.
9. Perform 6 X-axis (6a) rotations followed by 5 Y-axis (5b) rotations and then 3 Z-axis (3g) rotations. What are the sizes in degrees of each (a, b and g) of these individual rotations if the final rotation matrix is the inverse of the one obtained in problem 1 multiplied by 1.3? Consider P(2.1, 3.3, 0.7) given in global coordinates. Rotate P 27.6o around the X-axis, followed by 34.7o around the Y-axis and followed by 17.27o around the Z-axis. What are its new global coordinates? The matrix is the inverse multiplied by 1.3: Therefore the rotation matrix is given by: R = 1.3*(RZ,17.27RY,34.7RX,27.6)t, that is (from Octave): R = Now: 6a = atan2(r32, r33) or atan(r32/r33) = (180/pi)*atan2( , ) = => a = 5b = -asin(r31) = -(180/pi)*asin( ) = => b = 3g = atan2(r21,r11) or atan(r21/r11) = (180/pi)*atan2( , ) = => g =

6 EULER ANGLES The rotation about the Z-axis of the global coordinate is called precession, the rotation about the x-axis of the local coordinate is called nutation and the rotation about the z-axis of the local coordinate is called spin. The precession-nutation-spin rotation angles are also called Euler angles with many applications in kinematics. To go from the fixed global frame G(OXYZ) to the body frame B(Oxyz) We do 3 steps: 1. From G(OXYZ) to frame B’(Ox’y’z’) (left figure) by a j rotation around z’ 2. From B’(Ox’y’z’) to B’’(Ox”y”z”) (middle figure) by a q rotation around x” 3. From B”(Ox”y”z”) to B(Oxyz) (right figure) by a y rotation around z”

7 Euler’s twelve independent triple local rotations
Theorem: In 3D, any two independent orthonormal coordinate frames with a common origin can be related by a sequence rotations (not more than three) about coordinate axes, where no two successive rotations may be about the same axis. (What this theorem is saying is that any rotation can be represented by no more than three rotations about the coordinate axes) (In general, there are 12 different independent combinations of triple rotation about the local axes; 6 are attributed to Leonhard Euler: XYX, XZX, YXY, YZY, ZXZ, ZYZ, and 6 to Gerolamo Cardano: XYZ, XZY, YZX, YXZ, ZXY, ZYX). 1. RX,j RY,q RX,y 3. RY,j RX,q RY,y 5. RZ,jRX,q RZ,y 2. RX,j RZ,q RX,y 4. RY,jRZ,q RY,y 6. RZ,jRY,q RZ,y 1. RX,j RY,q RZ,y 3. RY,j RZ,q RX,y 5. RZ,j RX,q RY,y 2. RX,j RZ,q RY,y 4. RY,jRX,q RZ,y 6. RZ,j RY,q RX,y j “phi”; q “theta”; y “psi”. The ZYZ rotation sequence is used in aeronautical and dynamics.

8 EULER ANGLES - First Euler angle: Precession.
We want to go from the fixed global frame G(OXYZ) to the body frame B(Oxyz) We do this in 3 steps as follows: 1. FIRST STEP: Go from G(OXYZ) to frame B’(Ox’y’z’) (left figure) by a j rotation around fixed axis z’ coincident with fixed axis Z. We have the following equations: B’r = B’RG Gr, with B’RG = RZ,j where: RZ,j = cos j sin j - sin j 1

9 EULER ANGLES - Second Euler angle: Nutation.
2. SECOND STEP: B’ is now the new fixed global frame. We go from B’(Ox’y’z’) to B’’(Ox”y”z”) (left figure) by a q rotation around x” (coincident with x’). We have the equations: B”r = B”RB’ B’r, with B”RB’ = Rx,q where cos q sin q - sin q 1 RX,q =

10 EULER ANGLES – Third Euler angle: spin.
3. THIRD STEP: B” is now the new fixed global frame. Go from B”(Ox”y”z”) to B(Oxyz) (left figure) by a y rotation around z” (coincident with z). We have the equations: Br = BRB” B”r, with BRB” = Rz,y where RZ,y = cos y sin y - sin y 1

11 By the rule of composition of rotations we have:
EULER ANGLES By the rule of composition of rotations we have: Br = BRG Gr, with BRG = Rz,y Rx,q Rz,j That is: BRG = RZ,y RX,q RZ,j = cos y sin y - sin y 1 cos q sin q - sin q 1 cos j sin j - sin j 1

12 EULER ANGLES: Working out the General Formula
By the rule of composition of rotations we have: Br = BRG Gr, with BRG = Rz,y Rx,q Rz,j That is: BRG = Rz,y Rx,q Rz,j = cos y sin y - sin y 1 cos q sin q - sin q cos j sin j - sin j BRG = c y s y - s y 1 c q s q - s q c j s j - s j = cj sj -cqsj cqcj sq sqsj sqcj cq cj cy – cq sj sy cy sj + cq cj sy sq sy - cj sy – cq cy sj - sj sy + cq cj cy sq cy sq sj cj sq cq BRG = = c y s y - s y 1 cj sj -cqsj cqcj sq sqsj sqcj cq

13 EULER ANGLES – Calculation of Precession-Nutation-Spin.
By the rule of composition of rotations we have: Br = BRG Gr, with BRG = RZ,y RX,q RZ,j Given a precession-nutation-spin rotation matrix we are able to compute the corresponding precession, nutation and spin angles as we have done previously: BRG = cj cy – cq sj sy cy sj + cq cj sy sq sy - cj sy – cq cy sj - sj sy + cq cj cy sq cy sq sj cj sq cq = r r r13 r r r33 r r r23 We can identify immediately: cos q = r33. Next we identify: –cos j * sin q = r32 and sin q *sin j = r31. These two equations yield: - tan j = r31/r32. Lastly, we identify: sin q *sin y = r13 and sin q * cos y = r23. By division they yield: tan y = r13/r23. These equations allow us to calculate precession j, nutation q and spin y as follows: j = - atan(r31/r32) q = acos(r33) y = atan(r13/r23) provided that sin q ≠ 0 (equivalently cos q ≠ 1. ). Since sin2 q = 1 – cos2 q = 1 – (r33)2  |r33| < 1.

14 Exercise # 9: EULER ANGLES (Cont’d)
Euler Angle Rotation Matrix: Consider the precession-nutation-spin matrix BRG = RZ,y RX,q RZ,j, with precession j = 79.15o, nutation q = 41.41o and spin y = -40.7o. Find the corresponding precession-nutation-spin matrix by using the general formula. BRG = cj cy – cq sj sy cy sj + cq cj sy sq sy - cj sy – cq cy sj - sj sy + cq cj cy sq cy sq sj cj sq cq BRG = Then verify using the triple product for rotation of the axes. cos y sin y - sin y 1 cos q sin q - sin q 1 cos j sin j - sin j 1

15 Exercise # 10: EULER ANGLES (Cont’d)
Euler Angles of a local rotation matrix: Find a local rotation matrix by doing a 30o rotation about the z-axis, a 30o rotation about the x-axis and a 30o rotation about the y-axis. After the matrix has been found, determine the corresponding Euler angles of precession-nutation- spin. Solution: We use Ry,30 = cos b sin b - sin b 1 ; Rx,a = cos a - sin a sin a 1 ; Rz,g = cos g - sin g sin g 1 0.8660 0.5000 1 0.8660 0.5000 1 0.8660 0.5000 1 BRG = BRG = = - atan(r31/r32) q = acos(r33) y = atan(r13/r23) r r r13 r r r33 r r r23 = ; = - atan(0.6495/ ) q = acos(0.7500) y = atan( /1.3660) = q = y = atan( /0.50) = -40.7

16 EULER ANGLES: Small Angles (Cont’d)
Euler angles of rotation matrix for small angles: The major simplification is to assume the cosine = 1 and the sine = 0. Also , the sine of a small angle can be approximated roughly by the angle itself measured in radians. In the formula below we get: Solution: BRG = cj cy – cq sj sy cy sj + cq cj sy sq sy - cj sy – cq cy sj - sj sy + cq cj cy sq cy sq sj cj sq cq = (j+y) -(j+y) q q In the case that only the second angle, q, is very small, the Euler angles become: BRG = cos(j + y) sin(j + y ) – sin(j + y ) cos(j + y) Therefore, in the case of small angles, the angles j and y are indistinguishable even in the case when they are not too small. Lastly, the set of Euler angles in the rotation matrix above is not unique when q = 0.

17 A vector in 2D & 3D Coordinate Systems
In any coordinate system the unit vector r, that is a vector whose magnitude is 1, |r|= 1, corresponding to a vector r, the unit vector is given by: r = r/|r| Y Z j k x r = ai + bj + ck = |r|r i X bj ai ck |r| = a²+ b² + c² r X Y i j x r = ai + bj = |r|r ai bj |r| = a²+ b² r

18 A vector in 2D & 3D Coordinate Systems
In any coordinate system the unit vector r, that is a vector whose magnitude is 1, |r|= 1, corresponding to a vector r, the unit vector is given by: r = r/|r|2qq q1q11 Y Z j k x r = ai + bj + ck = |r|r i X bj ai ck |r| = a²+ b² + c² r X Y i j x r = ai + bj = |r|r ai bj |r| = a²+ b² r

19 Direction Cosines – in 2D 1
(Pre-requisites: Chapter 0b pages 15-16; remember the dot product of perpendicular vectors is 0 and the dot product of a unit vector by itself is just the unity, 1). The direction cosines (or directional cosines) of a vector are the cosines of the angles between the vector and the coordinate axes. Equivalently, they are the contributions of each component of the basis to a unit vector in that direction. X Y i j x ai bj r Consider a vector in 2D. Its description is: r = a i + b j. Multiplying the vector by i and j yields: r. i = a, and r. j = b. Since r. i= |r|*|i|*cos(r,i) and |r| = sqrt(a2+b2), |i| = 1, then cos(r, i) = r. i/sqrt(a2+b2). Similarly: cos(r, j) = r. j/sqrt(a2+b2). |r| = a²+ b² r = ai + bj = |r|r If we now consider the unit vector r, then cos(r, i) = r. i and cos(r,j) = r. j, therefore, in 2D, the directional cosines of vector r are r.i and r.j.

20 Direction Cosines – in 3D
Consider now a vector in 3D. Its description is: r = a i + b j + c k. Multiplying the vector by i, j and k yields: r.i = a, r.j = b and r.k = c. Therefore, the components of a given vector are the dot products of the vector and the corresponding unit vectors in the direction of the coordinate axes. We can write instead: r = (r.i) i + (r.j) j + (r.k) k. Consider now a vector in 3D. Its description is: r = a i + b j + c k. Multiplying the vector by i, j and k yields: r.i = a, r.j = b and r.k = c. Therefore, the components of a given vector are the dot products of the vector and the corresponding unit vectors in the direction of the coordinate axes. We can write instead: r = (r.i) i + (r.j) j + (r.k) k. Y Z j k x r = ai + bj + ck = |r|r i X bj ai ck |r| = a²+ b² + c² r As in the 2D case, we now consider the unit vector r, corresponding to vector r, then: cos(r, i) = r.i cos(r, j) = r.j cos(r, k) = r.k Therefore, in 3D the direction cosines of vector r are: r.i, r.j and r.k.

21 General Transformation
Consider a general situation in which two coordinate frames, G(OXYZ) and B(Oxyz) with a common origin O, are used to express the components of a vector r. There is always a transformation matrix GRB to map the components of r from the reference frame B(Oxyz) to the reference frame G(OXYZ). The equations are: Gr = GRB Br, from frame B to frame G and: Br = (GRB)-1 Gr = BRG Gr, from frame G to frame B where the determinants of the matrices are all 1, that is: det(GRB) = 1 and det(BRG) = 1. In addition, the inverses of the matrices are their transposes. That is, in general the matrices satisfy the property: BRG = (GRB)-1 = (GRB)t (we have seen this result several times now. Here we are just formalizing it!)

22 Expressing a vector in different coordinate systems
Consider the figure below. We can describe (decompose) the position r of point P in both coordinate systems (ignoring the subscript “P” everywhere). We write as follows: X y Z yP Yp Y B r P Xp Zp zP xP O G Gr = X I + Y J + Z K, in the G(OXYZ) system Br = x i + y j + z k, in the B(Oxyz) system. where the components of the vector can be written in terms of the dot products (as done earlier): Gr = (r.I) I + (r.J) J + (r.K) K, in the G(OXYZ) system. Br = (r.i) i + (r.j) j + (r.k) k, in the B(Oxyz) system.

23 Expressing the unit vectors of G(OXYZ) in terms of the unit vectors of B(Oxyz)
The figure below shows the global system G unit vectors (I, J, K) and the local system B unit vectors (i, j, k). We want to express the unit vectors of system G(OXYZ) in terms of the unit vectors of system B(Oxyz). We write: X y Z yP Yp Y B r P Xp Zp zP xP O G i j k I J K I = (I.i) i + (I.j) j + (I.k) k J = (J.i) i + (J.j) j + (J.k) k K = (K.i) i + (K.j) j + (K.k) k (as expected given our previous slide technique). We can now write this in matrix form as follows: = I.i I.j I.k J.i J.j J.k K.i K.j K.k i j k I J K GRB Where GRB is the transformation matrix which maps the local frame B to the global frame G. It must be clear that the elements of matrix GRB are the direction cosines of the axes of G(OXYZ) in frame B(Oxyz). Clearly, this set of 9 direction cosines completely specifies the orientation of the frame B(Oxyz) in the frame G(OXYZ), and can be used to map the coordinates of any point (x, y, z) to its corresponding coordinates (X, Y, Z). And vice-versa, expressing the inverse of GRB which is BRG = (GRB )-1 = (GRB )t. = I.i I.j I.k J.I J.j J.k K.I K.j K.k cos(I,i) cos(I,j) cos(I,k) cos(J,i) cos(J,j) cos(J,k) cos(K,i) cos(K,j) cos(K,k) GRB =

24 Matrices Orthogonality
Matrices that satisfy the property that their inverses are equal to their transposes, that is, (GRB )-1 = (GRB )t, are called orthogonal. Orthogonality of rotation matrix R comes from the fact that an orthogonal coordinate frame maps to another orthogonal coordinate frame. We look to check that the number of independent elements in R is just three. This comes from the fact that (GRB )(GRB )-1 = (GRB )(GRB )t = I. We could easily verify that from this identity we can derive 9 equations on the rij‘s by explicitly writing them from the equality: r r r13 r r r33 r r r23 r r r31 r r r33 r r r32 = Add to this the fact that (GRB )(GRB )t = I from which we can determine that det((GRB )(GRB )t) = det((GRB ))2 = 1 and thus det(GRB ) =  1 (the + sign gives us the right handed orientation we want). With this we have all the algebra we need to prove that there are only THREE INDEPENDENT elements in transformation matrix R. (We will not do it, just accept this general result. Maybe work it as an exercise?)

25 Exercise # 11: Direction Cosines
Determining a transformation matrix: Consider the figure below where the x-axis lies in the XZ plane at 40o above the X-axis and the angle between y and Y is 60o. Consider a point P(X,Y,Z) = P(100, -50, 150), that is: Gr = 100I – 50J + 150K. Find the coordinates of P in the frame B. (Notice that the x-axis, which lies in XZ, is perpendicular to the Y-axis ). Solution: First we need to find matrix BRG. i.I i.J i.K j.I j.J j.K k.I k.J k.K cos(40) cos(90) sin(40) j.I cos(60) j.K k.I k.J k.K j.I j.K k.I k.J k.K r r r13 r r r33 r r r23 BRG = = = = Now we use the property that matrix BRG GRG. = BRG( BRG)t = I , that is: r r23 r r r33 r r31 r32 r r33 =  Solve the 5 equations in rij (see next slide) Lastly: 100 -50 150 173.05 -68.75 -18.05 Br = BRG Gr = =

26 Exercise # 11: Direction Cosines (Cont’d)
We need the transformation matrix BRG. Out of the 9 parameters we know 4 of them. Need to determine the remaining 5 from: r r23 r r r33 r r31 r32 r r33 = 0.766 r r23 = 0  r23 = - (0.766/0.643)r21 = r21  (r23) 2 = (r21) 2 0.766 r r33 = 0  r33 = r31  (r33) 2 = (r31) 2 (r21)2 + (r23) = 1  r21 = sqrt(0.75/2.4192) =  r23 = r21*r r32 + r23*r33 = 0  r r32 + ( )( )r31 = 0  r32 = r31 (r31) 2 + (r32) 2 + (r33) 2 = 1 (r31) (r31) (r31)2 = 1  r31 = - sqrt(1/ ) The solution to this system of simultaneous equations (may need to use an equation solver) is: r21 = ok r23 = ok r31 = ok (if this is negative then r32 is positive and vice-versa) r32 = ok r33 = ok

27 Exercise # 12: Direction Cosines
Using Br and BRG to find out Gr: If now Br = 100i – 50j + 150k. That is, the vector is given in the B(Oxyz) system instead. Matrix BRG is given as before, find vector Gr in the O(XYZ) system. Solution: We use the equation: Br = BRG Gr and from this we have: Gr = (BRG)-1 Br = (BRG)t Br. Hence: Gr = 100 -50 150 = 0.45 104.9 154.9

28 Scratch Note : Solving a System of Equations
Let form a system of equations assuming that x =2 and y = 3; 3x + 7y = 27 / *2 6x + 14y = 54 x = 2 5x – 2y = 4 / * 7 35x – 14y = y = 3 If we note that given A = then: det(A) = ad – bc, and A-1 = a b c d d -b -c a 1 ad – bc We can write the system of equations above using the more convenient notation of matrices. We call A = , then det(A) = -1/41 and A-1 = (-1/41)* Lastly, call B = and X = 3 7 5 -2 27 4 x y Therefore, we write A*X = B and the answer is: X = A-1 *B, that is: = (-1/41)* - 82 -123 x y 27 4 2 3


Download ppt "Making a Point: Elementary (around Z) Rotations in 2D …"

Similar presentations


Ads by Google