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

Simple Euler (Tait-Bryan) rotation question

  1. Sep 17, 2015 #1
    Suppose an aircraft attitude is given by

    Heading=040 degrees

    Pitch=15 degrees Up

    Bank=20 degrees left bank

    And then the aircraft “yaws”, or rotates 30 degrees left about its yaw axis.

    What are the new Heading, Pitch and Bank angles?

    What do the rotation matrices look like that describe this sequence of four rotations, and how are the new attitude angles extracted from the resultant rotation matrix?

    Apologies for posting an apparently easy question, but I have been trying for some time and still cannot solve it.
     
  2. jcsd
  3. Sep 22, 2015 #2

    andrewkirk

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    You can find the matrices for 3D rotation about an axis here. They are for rotations around x, y and z axes. In an aeroplane, the x (roll/bank) axis points forward along the fuselage, the y (pitch) points starboard and the z (yaw) points towards the bottom of the plane. This page is helpful in understanding those axes.

    Start with the plane level and pointing north so that its x,y,z axes align with the geographic x,y,z axes. Then your four rotations need to be applied. A way to do this is to represent the plane's x,y,z axes by vectors that have coordinates (1 0 0), (0 1 0) and (0 0 1) respectively in the geographic coordinates. Then apply the four rotations. However, because the rotations are relative to the plane's axes - not the geographic ones, and the plane's axes change with each rotation, the trick is to apply them in the reverse order. A little mathematical fiddling shows that that produces the same result as applying them in the original order on transformed axes.

    So you left-multiply each of the three plane axis vectors (as column vectors) by
    Rz(-30) * Rx(-20) * Ry(15) * Rz(40)

    The vectors that are the result of that multiplication give the plane's final orientation, in terms of the geographic coordinates.
     
  4. Sep 24, 2015 #3

    andrewkirk

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    I didn't check the calcs but that looks about right. The vector is the direction that the fuselage now points (the plane's roll(x) axis), in the world coordinates. You can see from the coords that it's just a bit to the East of North and pointing up a bit (remember that the positive z direction is down), which is what you'd expect from those movements.

    By applying the same matrix multiplication to the other two basis vectors, you'll get the direction of the other two transformed plane axes (although only one of the two is needed to completely specify the orientation).
     
  5. Sep 24, 2015 #4
    First off, Andre, thank you so much for taking the time to help me. Your efforts are greatly appreciated.

    It is quite embarrassing to admit that I still do not understand this. I know that I am missing something very fundamental, doing something very wrong, but I don't see it yet.

    Here's my interpretation of your suggestion:

    Rotation #4: Final Yaw rotation around the airplane Y axis: 40 degrees counter clockwise = -40
    Rotation #3: Aircraft Bank: 20 degrees left = -20
    Rotation #2: Aircraft Pitch: 15 degrees up = 15
    Rotation #1: Aircraft Heading = 040 degrees

    The elemental Rotation Matrices

    D: Rz(-30) =
    Code (Text):

     0.8660  0.5000  0
    -0.5000  0.8660  0
       0       0     1
     
    C: Rx(-20) =
    Code (Text):

    1     0       0
    0   0.9397  0.3420
    0  -0.3420  0.9397
     
    B: Ry(15) =
    Code (Text):

     0.9659   0   0.2588
       0      1     0
    -0.2588   0   0.9659
     
    A: Rz(40) =
    Code (Text):

    0.7660  -0.6428   0
    0.6428   0.7660   0
      0        0      1
     
    and

    Rz(-30)*Rx(-20)*Ry(15)*Rz(40) =
    Code (Text):

     0.9089  -0.1493   0.3893
     0.0944   0.9831   0.1567
    -0.4062  -0.1057   0.9077
     
    which, in excel, is in the form: mmult(D,mmult(C,mmult(B:A)))

    At this point, if I left multiply Rz(-30)*Rx(-20)*Ry(15)*Rz(40) by the three aircraft vectors I get
    Code (Text):
     
     0.9089  -0.1493   0.3893         1       0.9089
     0.0944   0.9831   0.1567    *    0   =   0.0944
    -0.4062  -0.1057   0.9077         0      -0.4062
     
    Code (Text):
     
     0.9089  -0.1493   0.3893         0      -0.1493
     0.0944   0.9831   0.1567    *    1   =   0.9831
    -0.4062  -0.1057   0.9077         0      -0.1057
     
    Code (Text):
     
     0.9089  -0.1493   0.3893         0       0.3893
     0.0944   0.9831   0.1567    *    0   =   0.1567
    -0.4062  -0.1057   0.9077         1       0.9077
     
    I do not know what to do with those nor the significance of the column vector multiplication given that I already have the rotation matrix.

    I also attempted to extract Euler angles from the rotation matrix

    Rz(-30)*Rx(-20)*Ry(15)*Rz(40) :
    Code (Text):

    11  12  13:     0.9089  -0.1493   0.3893
    21  22  23:     0.0944   0.9831   0.1567
    31  32  33:    -0.4062  -0.1057   0.9077
     
    where

    Pitch = -asin(R31)

    Bank = atan2(R32/cos(pitch), R33/cos(pitch))

    Hdg = atan2(R21/cos(pitch), R11/cos(pitch))

    But these yield a non-sensical:

    Pitch = 23.96 degrees
    Bank = 96.64 degrees
    Hdg = 84.07 degrees

    Lastly, to explain how I am thinking about it, I have the idea stuck in my head that if I use 0 degrees for the final Yaw rotation, then I should be able to extract

    Pitch = 15 degrees
    Roll = -20 degrees
    Hdg = 040 degrees

    out of a rotation matrix.

    (actually, a rotation matrix formed by the multiplication mmult(A,mmult(B,mmult(C:D))) "seems" to yield angles that make more sense, but I cannot get the fourth rotation, the final Yaw around the aircraft Y axis to work no matter what I try.)

    Further, if I use 90 degrees for the final Yaw rotation, then the Pitch and Roll will flip and I will extract:

    Pitch = -20 degrees
    Roll = 15 degrees
    Hdg = 130 degrees

    out of the "rotation matrix”. But, of course, I don’t.

    The “answer” I need will be in the form of angles – the new aircraft attitude angles after the four rotations.

    Apologies for taking so long to understand this, but I still don’t understand where I am going wrong.

    Thank you again, and regards,

    Bob
     
    Last edited: Sep 24, 2015
  6. Sep 24, 2015 #5
    Ooops ... I was editing my last response when you posted ... Bob
     
  7. Sep 24, 2015 #6
    Hmmm,

    To make sure that I understand, when you say "You can see from the coords that it's just a bit to the East of North and pointing up a bit (remember that the positive z direction is down), which is what you'd expect from those movements.", you are looking at

    Code (Text):
     0.9089  -0.1493   0.3893         1       0.9089
     0.0944   0.9831   0.1567    *    0   =   0.0944
    -0.4062  -0.1057   0.9077         0      -0.4062
     
    and the resulting column vector 0.9089 ... 0.0944 ... -0.4062 looking along the aircraft x (fuselage) axis is what you describe. OK, that ought to give me Pitch and Heading, so I still need another elemental rotation to get Roll ...

    I think I finally see the light! Let me work with this.

    Thanks so much!

    Bob
     
    Last edited: Sep 24, 2015
  8. Sep 24, 2015 #7
    Andre,

    This still isn’t working for me. Maybe it's wrapped up with intrinsic vs. extrinsic rotations and the actual nature of aircraft attitude angles as measured by the aircraft instruments (that's what I'm using as my "input"). I’m not sure.

    As I view the problem, if the fourth rotation, the “Final Yaw” around the airplane Z axis, is zero, then a proper rotation matrix should return the given aircraft attitude angles. However, Rz(-30)*Rx(-20)*Ry(15)*Rz(0) doesn’t do that. Further, if I change Pitch up or down a few degrees, that matrix multiplication will change the Heading value also, which is not correct in an aircraft where Pitch change does not affect Heading.

    So, is it correct that this problem reduces to a single rotation defined as

    Roll = Rx(u): Angle u around the aircraft X axis
    Tilt = Ry(v): Angle v around the aircraft Y axis
    Yaw = Rz(w): Angle w around the aircraft Z axis
    Code (Text):

    Rx(u)
      1    0     0
      0  c(u) -s(u)
      0  s(u)  c(u)

    Ry(v)
    c(v)    0  s(v)
       0    1    0
    -s(v)   0  c(v)

    Rz(w)
    c(w) -s(w)   0
    s(w)  c(w)   0
      0     0    1
     
    The resulting rotation matrix is Rz * Ry * Rx = RzRyRx

    The given aircraft attitude is a column matrix Attitude (-20 Bank, 15 Pitch, 040 Heading)
    Code (Text):

    Attitude
      -20
       15
       40
     
    The rotated Bank and Pitch is calculated by applying the matrix multiplication RzRyRx * Attitude. However, the resulting new Heading is defined as mod(Yaw(w) + Heading, 360). Now, a Yaw angle, w, of 90 degrees flips the Pitch and Bank, which is what I want.

    But this seems a little awkward, or forced, and I still have to deal with the fact that Bank range is -180 to +180 but Pitch is just -90 to +90 and when they flip at Yaw = 90 degrees, I could have an issue to correct (rotated Pitch could exceed abs(90) so that needs to be adjusted). There are other issues, or adjustments, dealing with inverted flight to work out, too.

    Thanks again for all of your help. I need to think about this a lot more. I have been searching for the elegant solution and I don't think I'm there yet.

    You mentioned the value of thinking about this as a vector problem - a Point vector and a Top vector. I need to understand that approach. Maybe it is the way to go. In addition to your response to my other question in this forum, there is a short thread on this over at stackoverflow.com but the moderator shut it down because it was just math and not code.

    http://stackoverflow.com/questions/21622956/how-to-convert-direction-vector-to-euler-angles

    I'll worry about Quaternions in some other lifetime.

    Bob
     
    Last edited: Sep 24, 2015
  9. Sep 24, 2015 #8

    andrewkirk

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Are you sure? Consider a plane that is flying level, pitched flat, heading North-East, banked 45 degrees to Port. Now say it starts to pitch up (rotate around its transverse axis) and continues until it is pointing 45 degrees above the horizontal in the x-z plane. Then its heading is North. We ignore here the fact that the heading and pitch will have changed further as the bank makes the plane execute a curve around its yaw axis.

    Pitch changes affect Heading, because Heading is an angle relative to the geo coordinate frame, whereas Pitch is a rotation around an axis of the plane's coordinate frame. We need to distinguish between Heading and Yaw. Yaw is a rotation around the plane's z/Yaw axis, and a pitch change (rotation around plane's y/Transverse axis) does not have a Yaw component because the plane's y and z axes are orthogonal. But the plane's y axis is not orthogonal to the geo z axis if the plane is banked, so a pitch change will have a component that is a rotation around the geo z axis.
    Yes. Any sequence of rotations, however long, can be expressed as three successive rotations, one around each axis. So a plane's orientation can be expressed as three such rotations, starting with the plane's axes aligned with the geo axes. I think the usual order is Yaw then Pitch then Bank. The good thing about that order is that the Heading is set by the Yaw rotation and not altered by the subsequent Pitch and Bank (whereas it would be altered if it were Bank then Pitch). That sequence is usually implemented in the easier way of rotations around the fixed geo axes, in the reverse order: Bank then Pitch then Yaw.
    Yes that's the attitude before the 30 degree yaw. But because the yaw is around the plane's z axis, not the geo z axis, we can't just subtract 30 from the Heading. We need to do the matrix multiplications.
    No. The rotation matrices are for applying to vectors in a Cartesian frame, not angle vectors. I find it easiest to work entirely with Cartesian vectors rather than angles, and then extract the H,P,B angles from the three attitude vectors at the very end.

    To extract the angles BPH from attitude vectors, use the matrix equations:

    (1) Rz(H) * Ry(P) * Rx(B) * (1 0 0) = v(x,plane)
    (2) Rz(H) * Ry(P) * Rx(B) * (0 1 0) = v(y,plane)

    where v(x,plane) and v(y,plane) are the plane's x and y axis vectors.

    You'll get a whole bunch of equations and putting them together judiciously allows you to solve for B, H and P. You only need to use a few of the equations.
     
  10. Sep 24, 2015 #9
    Andre,

    Thanks to your patient explanations, the light finally went on for me. I had a visualization problem. When I thought of the final Yaw rotation, I now realize I had always visualized it at Bank=0 or at Pitch=0, and in those two specific attitudes only, a 90 degree Yaw flips the Pitch and Bank, and the new Heading is old Heading plus Yaw.

    This is what I have now. I hope it is finally correct. Using the elemental rotation matrices:
    Code (Text):

    Rx(u)
      1    0     0
      0  c(u) -s(u)
      0  s(u)  c(u)

    Ry(v)
    c(v)    0  s(v)
       0    1    0
    -s(v)   0  c(v)

    Rz(w)
    c(w) -s(w)   0
    s(w)  c(w)   0
      0     0    1
     
    with,

    Aircraft Attitude: u,v,w = Bank, Pitch, Hdg
    Final Rotation: u,v,w = Roll, Tilt, Yaw (this is a 'swiveling' camera view in the aircraft, for example)

    The resulting rotation matrix is:

    Rz(Hdg) * Ry(Pitch) * Rx(Bank) * Rz(Yaw) * Ry(Tilt) * Rx(Roll)


    From this rotation matrix, I extracted H-P-B angles using
    Code (Text):

    r11  r12  r13
    r21  r22  r23
    r31  r32  r33

    Bank = atan2(r33,r32)
    Pitch = -asin(r31)
    Hdg = atan2(r11,r21)
     
    Example:

    Aircraft Bank = -20
    Aircraft Pitch = 15
    Aircraft Heading = 040

    Camera Roll = 0
    Camera Tilt = 0
    Camera Yaw = -30

    Rz(Hdg) * Ry(Pitch) * Rx(Bank) * Rz(Yaw) * Ry(Tilt) * Rx(Roll) =
    Code (Text):

    0.9767   -0.2119  -0.0335
    0.2062    0.8846   0.4183
    -0.0590  -0.4155   0.9077
     
    From which the new camera view angles are

    Bank = -24.6 degrees
    Pitch = 3.38 degrees
    Heading = 11.92 degrees

    Maybe I finally have got it right! But if not, I will keep working it...

    Thanks,

    Bob
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Simple Euler (Tait-Bryan) rotation question
  1. A Rotation Question (Replies: 13)

Loading...