Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

3D Rotations - Confused with multiple rotations

  1. May 15, 2013 #1
    I've been trying to wrap my head around 3D rotations and specifically, Euler angles. I thought I had a good understanding of performing multiple rotations, but after writing a Matlab script that graphically shows my rotations, I am not so sure right now.

    My biggest hang up is whether or not a rotation is ALWAYS taken about the original frame or if it taken about a intermediate frame. For example, the ZXZ Euler rotation from the original frame ##\vec{X}## to the final frame ##\vec{x}## is described as:

    1. Rotation about ##Z## by angle ##\phi## to get intermediate frame ##\vec{x}_1##

    ##\vec{x}_1 = R_Z(\phi)\vec{X}##

    2. Rotation about ##x_1## by angle ##\theta## to get intermediate frame ##\vec{x}_2##

    ##\vec{x}_2 = {R_x}_1(\theta)\vec{x}_1##

    3. Rotation about ##z_1## by angle ##\psi## to get final frame ##\vec{x}##

    ##\vec{x} = {R_x}_2(\psi)\vec{x}_2##


    Making substitutions, the final rotation matrix is ##\vec{x} = {R_x}_2(\psi){R_x}_1(\theta)R_Z(\phi)\vec{X} = R\vec{X}##


    That makes sense with those equations, but then when I go to plot it to see each individual step, it doesn't make sense. It seems like each rotation is always taken about the original frame.

    A better example is from a paper I went through:

    d22nCJA.jpg

    The rotation is described by: "first a rotation about ##z## (the original frame) by an angle ##\alpha##, then a rotation about the rotated-intermediate frame y axis by an angle ##\beta##"

    This makes sense looking at the picture. So I go through the math just like above in the ZXZ Euler angles and get:

    ##\vec{x}_1 = R_z(\alpha)\vec{x}##

    ##\vec{x}_2 = {R_y}_1(\beta)\vec{x}_1##

    ##\vec{x}_2 = {R_y}_1(\beta)R_z(\alpha)\vec{x} = R\vec{x}##

    If I compute this rotation matrix ##R## and perform the rotation, it doesn't come out right. However, if I reverse the order of rotation by 1) rotate by ##\beta## about original y axis, then 2) rotate by ##\alpha## about original z axis, I get:

    ##\vec{x}_2 = R_z(\alpha)R_y(\beta)\vec{x} = R\vec{x}##

    38cVkbt.jpg

    This resulting rotation matrix works correctly when I plot it and is the same rotation matrix given in the paper. But, it all boils down to that I always considered rotating about the original frame.

    Can someone help me with this madness! My brain hurts. :biggrin:
     
  2. jcsd
  3. May 15, 2013 #2
    I'm confused as well, are spatial rotations commutative?
     
  4. May 15, 2013 #3
    Spatial rotations are not commutative. The order matters for sure. From first learning about 3D rotations, I always thought they were about the original frame. Then I started reading about Euler angles where there is mention of rotating about intermediate frames. So, now I'm here.

    I forgot to mention, this is what I was looking at for the Euler angles

    http://ocw.mit.edu/courses/aeronaut...fall-2009/lecture-notes/MIT16_07F09_Lec29.pdf

    A lot of other sources state the same thing (about rotating about intermediate frames).
     
    Last edited: May 15, 2013
  5. May 15, 2013 #4
    I found a source that I believe addresses the questions I have, though I am still trying to grasp what is going on. See attached. "Composition of Rotations" starts on pg 38. I will reiterate just so I can understand it.

    Rotation matrix ##R^1_0## represents a rotational transformation between frames ##\vec{ox}_0## and ##\vec{ox}_1##. So given a vector w.r.t. ##\vec{ox}_1##, ##\vec{p}_1##, you can transform that vector into the ##\vec{ox}_0## frame by ##R^1_0\vec{p}_1##.

    Now suppose you have a third frame, ##\vec{ox}_3##. We have the following:

    ##R^1_0## : rotation between frame 0 and 1
    ##R^2_0## : rotation between frame 0 and 2
    ##R^2_1## : rotation between frame 1 and 2

    ##\vec{p}_0##, ##\vec{p}_1##, ##\vec{p}_2## are vectors wrt frame 0, frame 1, and frame 2, respectively.

    ##\vec{p}_0 = R^1_0\vec{p}_1## : take vector wrt frame 1 and transforms it to frame 0 coordinates

    ##\vec{p}_0 = R^2_0\vec{p}_2## : take vector wrt frame 2 and transforms it to frame 0 coordinates

    ##\vec{p}_1 = R^2_1\vec{p}_2## : take vector wrt frame 2 and transforms it to frame 1 coordinates

    Combining:
    ##\vec{p}_0 = R^1_{0}R^2_1\vec{p}_2 = R^2_0\vec{p}_2##

    This makes sense to me and by using this I was able to the correct rotation matrix from the example I gave before (by using intermediate frames). This I pulled from the attached source makes has a good explanation, esp the last paragraph:

    q80UJe2.jpg

    So I think I understand that. But, now going back to the Euler angles I posted before. I tried this method and got the reverse sequence of transformations. I think it has to do with what direction you are transforming, i.e. are you transforming from your final frame to your fixed frame, or from your fixed frame to your final frame?

    So, at least for now, I've drawn this conclusion: If you are making sequential transformations by transforming about intermediate frames, the transformation matrices are multiplied in order, from left to right (i.e. T1*T2*T3*...*Tn). If you are making sequential transformation but around a fixed axis, the transformation matrices are multiplied right to left (i.e. Tn*...*T3*T2*T1).


    Still kinda confused, but making progress! Does anyone understand where I am hung up?
     
    Last edited: May 15, 2013
  6. May 15, 2013 #5

    SteamKing

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    I always used fixed frames to keep my head from exploding.
     
  7. May 15, 2013 #6
    I hear ya! Seems like the best way to go, especially if you are working with moving rigid bodies like aircraft/spacecraft. I'm sure there are special cases when you work in a moving/rotating frame (e.g. spinning top).

    I believe I figured out all of my problems. It came down to intrinsic (using intermediate frames) vs. extrinsic (using the fixed frame) transformations as well as forward and inverse transformations.

    Believe it or not wikipedia had the best information on all of this. I skimmed across it before, but that must have been before I knew what I was looking for. It explains intrinsic and extrinsic rotations pretty thoroughly.

    Then, the reason I was getting stuck with that MIT paper I referenced is that they are doing the inverse transformation (i.e. given a vector in the fixed frame X-Y-Z coordinates, transform it into the rotating frame x-y-z coordinates), instead of the normal forward transformation from rotating frame coordinates into fixed frame coordinates. Wikipedia lists the forward, intrinsic Euler angles. Lo and behold, if you take the forward, intrinsic ZXZ Euler angles from wikipedia and transpose it to get the inverse, you get the answer from the MIT paper.

    Phew! I think I can let my brain rest...for now. Next is delving into the angular velocity of the rotating frame and how that is transformed/represented. That's what got me into this mess in the first place!
     
  8. May 15, 2013 #7

    BobG

    User Avatar
    Science Advisor
    Homework Helper

    There's several different sequences one could do your rotations, depending on what you want to do. The main rule is that you can't rotate around the same axis twice (that would really be just one rotation a little at a time).

    That gives you 12 possible rotation sequences. They're not all unique. Some of the sequences duplicate each other.

    XYZ and ZXZ are two sequences that happen to duplicate each other. You pick the sequence that has the best defined angles. That would be the XYZ rotation sequence in your example.

    In an XYZ sequence, the first rotation should rotate the y-axis into the fundamental plane. In your example, y is already in the fundamental plane, making your first rotation equal to 0 degrees (i.e unnecessary). Only the YZ rotations have to be made.

    I think you were alluding to this in your last post, but there is a difference between rotating a vector and rotating a coordinate frame. If you're rotating a vector counter-clockwise, the coordinate frame would appear to be rotating clockwise from the vector's point of view. If you're rotating the coordinate frame counter-clockwise, an observer in that frame of reference would see the vector rotating clockwise.
     
    Last edited: May 15, 2013
  9. May 16, 2013 #8
    Thanks for chiming in!

    Can you explain how the XYZ and ZXZ duplicate each other? Like you can arrive at the same end orientation with the two different sequences?

    Yes, the XYZ (extrinsic) sequence will work for my example, which is what used in my own derivation when I couldn't figure out how the author used the ZYX sequence. But, once I figured out intrinsic vs. extrinsic, I realized the author used the ZYX intrinsic sequence and it all made sense.


    I know exactly what you are saying and this is what confused me a lot when I was going through this. Like you said, it all depends on where you are observing the rotation from. In the MIT paper I was working through, all of their rotations are wrt to the new frame, even though they don't explicitly say that. For example, the first rotation "from an initial ##X,Y,Z## system into an ##x',y',z'## system through a rotation ##\phi##" makes it seem like the observer is at the ##X,Y,Z## system watching the ##x',y',z'## system rotate, but their equation shows otherwise. Instead, its as if the observer is in the rotating frame watching the ##X,Y,Z## system rotate by ##-\phi##. Thus their rotation matrix is the inverse of what we would normally see.

    IKibWqz.jpg

    That is kind of a abstract way of thinking about it when basically its just a inverse transformation, i.e. given a point in the ##X,Y,Z## system coordinates, transform it into the ##x',y',z'## system coordinates. When we are use to seeing the forward transformation, given a point in the ##x',y',z'## system coordinates, transform it into the ##X,Y,Z## system coordinates.

    When would an inverse transformation like the one derived in the MIT paper be useful? It seems to me the real valuable transformation is only the forward...at least from my perspective of dealing with rigid bodies moving in a fixed frame. You always want to know what the rigid body is doing wrt the fixed frame, so all you need is the forward transformation. I'm sure there is a reason, its just weird to see it derived that way.

    Anyways, thanks again. It's all becoming more and more clear.
     
    Last edited: May 16, 2013
  10. May 16, 2013 #9

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    When a composition of frames is used to express aircraft and spacecraft attitude, it's almost always in terms of the sequence of frames approach ("Euler angles") as opposed to a composition of fixed frames rotations. The latter just doesn't make much sense. Whether a plane is climbing, diving, or flying straight and level, the ailerons make a plane roll. Combine the ailerons (roll) with the elevators (pitch) and you get a banked turn, roll+pitch, not yaw. Pilots think in terms of the body frame, not the Earth-fixed frame. The same goes for spacecraft. The roll jets make the spacecraft roll, regardless of orientation. Rotation sensors have a fixed orientation with respect to structure; they measure things in the body frame. Even the artificial horizon sensor can be thought of as representing the orientation of the Earth-fixed frame with respect to the body frame.


    One source of confusion, and I think you ran into it, is the difference between what I call rotation versus transformation matrices. (Wikipedia confusingly (IMO) calls them active and passive transformation matrices.) A rotation matrix represents the physical rotation of some object. For example, imagine a sheet of transparency sheet that's placed over a sheet of white paper. Both the sheet and paper have a central dot and a pair of orthogonal axes. Align the axes, now rotate the transparency. That rotation can be expressed in terms of a 2x2 matrix. Now suppose the both the sheet and paper have grid lines on them, and the paper has a point away from the origin marked on it. Repeat the procedure. You can read off the coordinates of the point from the paper or from the sheet. The matrix that transforms the paper coordinates to sheet coordinates is a transformation matrix.

    These two matrices, the rotation and transformation matrix, are obviously related. They are in fact transpose of one another. This is one of many places where you can get confused, particularly if the paper/book you are reading doesn't say what convention they are using. Because they are transposes of one another, a composition of rotation matrices chains the opposite way that the composition of the corresponding transformation matrices chains. If one chains as A*B*C, the other chains as CT*BT*AT. You always need to figure out what convention is being used.


    While I've seen lots of conventions for matrices and quaternions, I've only seen one for angular velocity. It's almost inevitably the angular velocity of the rotating object with respect to the parent reference frame, but expressed in terms of rotating frame coordinates.
     
  11. May 16, 2013 #10
    I completely agree with you. Not sure why I made that comment...I think I was talking about observing the system from the fixed frame, rather than from the rotating frame.

    Yep, definitely a source of confusion. Thanks for bring this up. Up until I really dug deeper into this topic, my understanding was strictly rotations because that made the most sense (you call it rotation - wiki calls it active transformation). It makes the most sense to me (especially when you have rotating frames within rotating frame, e.g. a multi dof robot arm) because when developing the kinematics of a system you want to get everything in terms of the reference frame. So, say you have a vector in your rotating frame (maybe this vector describes the location of the origin of the other rotating frame), what is it in the global reference frame? Well, you just apply the rotation to the vector and that switches your coordinates. To me, performing the inverse transformation isn't that useful...but it probably depends on the system and application. Can you give an example of when you would want to use the inverse?

    After reading about it, another way I think about the rotation/active vs transformation/passive is just what direction you are doing the transformation. The active/rotation takes a point in the rotating frame coordinates and transforms it into the fixed frame coordinates. The passive/transformation takes a point in the fixed frame coordinates and transforms it into the rotating frame coordinates. And like you said, they are just inverses of each other.

    So then this leads me to the derivation of the ZXZ Euler angles in that MIT paper. Their final Euler transformation is:

    dhd2Yrs.jpg

    Deriving the inverse (passive) transformation as they show here just doesn't make sense to me. Especially when their wording throughout the derivation makes it seem like they are doing the forward (active) transformation. Why not derive the forward transformation? Again, it comes back to my question: what purpose does the inverse have in coming up with the kinematics and dynamics of a system?

    I think that is what I ran into as well. By having the angular velocity in terms of the rotating frame coordinates, then it is easy to find the rotational KE of the body with the moment of inertia tensor that is defined in the rotating frame. Is that right? Or transformations of the tensor necessary? This topic probably deserves another discussion.

    Thanks for the help! I really appreciate it!
     
  12. May 16, 2013 #11

    BobG

    User Avatar
    Science Advisor
    Homework Helper

    Transformations go two ways. For example, if you have to transform topocentric coordinates to geocentric coordinates (a tracking station's observations into a state vector for the object, for example), a different tracking station would have to transform the geocentric coordinates into topocentric (turn the state vector into look angles for their own tracking antenna).

    And, if the matrix is a right handed orthogonal matrix made up of unit vectors, which all of your rotation matrices are, the inverse and the transpose are one and the same. Kind of handy since you're lucky to construct your rotation matrix error free even once. (There's actually some easy error checking tests you can do for orthoganality. If you're building your matrices in a spreadsheet, it's best to have your error checking tests saved somewhere and every rotation matrix you build is started by pasting in the error checking.)

    The sum of the squares of each row should equal 1; the sum of the squares of each of the columns should equal 1 (they are unit vectors, after all).

    The dot product of any two rows should equal 0. In other words, the dot product of the 1st and 2nd row, the dot product of the 2nd and 3rd row, the dot product of the 3rd row and 1st row should all be zero. Likewise for each column. In other words every row should be perpendicular to the other two rows; every column should be perpendicular to the other two columns.

    The determinant of the matrix should be +1 for right handed orthogonal matrices (which virtually all of the rotation matrices you build will be). It will be -1 for left handed matrices. If it's some other value besides +1 or -1, then you must not have done the second test.

    There's also a cofactor test, but it just ensures your matrix is correct even if you chose a bad example for your angles. Rather than learn the cofactor test, it makes more sense to avoid angles of 0 degrees, 90 degrees, 180 degrees, or 270 degrees when testing your matrix.
     
  13. May 16, 2013 #12
    Thanks for the example!

    In my mind, the simple answer is to just have transformations (from rotating frame to fixed) and inverse transformations (fixed frame to rotating frame). Whether or not they are extrinsic or intrinsic, that is up to the person formulating the system. There. End of story. But, instead, all these passive/active terms get thrown around and talking about points moving vs coordinate frames moving, etc...get's confusing! :tongue:
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook