1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Modeling Rigid Body - Unsure about Euler angles and angular velocity

  1. May 20, 2013 #1
    I'm modeling a single 3D rigid body in preparation for some more complicated modeling in order to gain a better understanding of Euler angles, the angular velocity vector and the rotating coordinate system.

    The body is rotated in inertial frame by an intrinsic ZXZ rotation, with respective state variables ##\alpha##, ##\beta##, and ##\gamma##. Thus, I have the rotation matrix ##R## that will transform points in the body frame coordinates into fixed frame coordinates...and vise versa.

    I have composed the angular velocity of the body frame relative to the fixed frame described in fixed frame coordinates, then transformed this into body frame coordinates by ##\vec{\omega}=R^T{\vec{\omega}}_{fixed}##. My moment of inertia tensor for the body is diagonal, and described in body frame coordinates (lets just call it a sphere).

    The kinetic energy of the body is then ##T = \frac{1}{2}\vec{\omega}^TI\vec{\omega}##

    I formulated the dynamics using Lagrange's equations, and included torque inputs on each of the rotation variables: ##\tau_{\alpha}##, ##\tau_{\beta}##, and ##\tau_{\gamma}## (which can be zeroed during simulation). I simulated and plotted the behavior in Matlab with various initial conditions and inputs. I also plotted angular velocity vector in both frames.

    If I mess with one state variable at a time, the model behaves exactly how I would expect. For example, I can set an initial velocity to ##\beta## and it will spin about the X axis. Or apply a torque ##\tau_{\gamma}## and it will spin about the Z axis.

    But, if I include two initial velocities (no inputs), say ##\alpha## and ##\beta##, I would expect it to spin about the Z axis while also spinning about the intermediate X axis. And if the speeds were the same, I'd expect them each to complete one rotation at the same time. Well, the body does have an off axis movement, but not like I would expect. Maybe it is just hard to visualize the body moving about two axes.

    I would also expect (I think) the angular velocity vector to maintain the same magnitude and direction; it does maintain the magnitude, but not the direction (in the body frame). Is this not right?

    Either my modeling is wrong or I do not fully understand Euler angles. As it is right now with my model, there is no intuitive sense to what the model will do given the inputs. For example, if I did a yaw-pitch-roll rotation, it seems like I could control each maneuver independently from each other...like, say make it roll while yawing. Is this not correct?

    If you could shed any light on my throught process for the modeling, that would be great! One thing I was unsure of was what coordinate system (fixed or body) to calculate the rotational KE. I did it in the body frame, but didn't know if I was suppose to transform everything to the fixed frame.
  2. jcsd
  3. May 21, 2013 #2

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    For a body rotating in three dimensions there is always a single axis of rotation about which the body is rotating at any one instant in time. That single axis of rotation is fixed in the special case of a constant angular velocity. The angular velocity vector points along that axis of rotation. In the case of non-constant angular velocity, there is still an instantaneous axis of rotation.

    Rotation is more complex than translation, but nonetheless there are similarities between the two. Plot position as a function of time. Since position varies smoothly with respect to time, a tangent to that position curve always exist. The translational velocity points along that tangent line. Translational velocity "lives" in the tangent space of position. The rotational analog to this is that angular velocity "lives" in the tangent space of rotation.

    There is a difference between translation and rotation here. The tangent space to ℝn (the space in which n-dimensional position vectors live) is ℝn. Position vectors and velocity vectors live in the same space. That's not the case with rotation. The tangent space to SO(n) (the space in which rotations in n-dimensional space live) is the vector space of nxn skew symmetric matrices. In the special case of rotation in three dimensions, a 3x3 skew symmetric matrix has three independent members. Pluck these off in the right order and with the right sign convention and you get something that looks like a whole lot like a 3-vector. This 3-vector is angular velocity. A better name is a pseudo vector.

    Another similarity: In undergraduate classes you get nice, analytic solutions to homework problems on translation and rotation. As soon as you get to complex, real-world problems, you need to toss those analytic solutions out the door. You need to resort to numerical treatments. In college one integrates some well-behaved acceleration analytically to yield velocity and position. In the real world one integrates a ratty, poorly-behaved acceleration numerically to yield estimates of velocity and position. The same applies to rotation.

    Nobody uses Euler angles to do that numerical integration. Nobody. Some use 3x3 rotation matrices to represent orientation in three dimensional space, others use quaternions, yet others use stranger representations such as Rodrigues parameters. Integrating a 3x3 rotation matrix or a quaternion is hard enough. Integrating Euler angles: Yech! Think of Euler angles as a representation scheme for non-geometrically inclined humans who can't grok the representations from abstract geometry that are much more amenable to numerical analysis.

    As for the derivative: Almost everyone uses angular velocity as a 3-vector but with the vector expressed in body frame coordinates. One reason for this seemingly backwards convention is that it dates back to Euler. Another is that it is well-suited to guidance and control. Sensors and effectors are fixed in the body frame, so expressing angular velocity in the body frame works quite nicely with control systems.

    There is one unfortunate side side effect of representing angular velocity in the body frame. The body frame is rotating. Newton's second law takes on some extra twists and turns when one tries to apply F=ma in a non-inertial frame. These extra twists and turns are the fictitious forces such as the centrifugal and coriolis forces. The rotational analog of F=ma also takes on some extra twists and turns, Euler's equations, when applied in a non-inertial frame. The best way to think of Euler's equations is that they are a fictitious torque and can be expressed compactly as [itex]-\vec{\omega}\times (I\vec{\omega})[/itex].
  4. May 21, 2013 #3
    Thanks for the response and the great explanations. I'll be referring to my rotation angles so I should problem specify exactly what I did with the Euler angles.

    ZXZ rotation:
    1) Rotate by ##\alpha## about Z axis of initial frame.
    2) Rotate by ##\beta## about X axis of 1st intermediate frame.
    3) Rotate by ##\gamma## about Z axis of 2nd intermediate frame.

    This is what I thought. So something is up with my math. I'm seeing the angular velocity vector changing direction even with constant ##\dot{\alpha}##, ##\dot{\beta}##, and ##\dot{\gamma}##. I think my problem lies in what frame I'm defining my angular velocity vector. Should I get the same result for angular KE if my angular velocity vector and inertia tensor are properly transformed to either frame? i.e. Say I have ##\vec{\omega}_B## and ##I_B## for the angular velocity and inertia tensor in the body frame. Can I transform each of those into the fixed frame and calculate the angular KE there? I couldn't quite get it to work:

    Body Frame:
    ##T_B = \frac{1}{2}{\vec{\omega}_B}^T{I_B}\vec{\omega}_B##
    Fixed Frame:
    ##T_F = \frac{1}{2}{\left(R\vec{\omega}_B\right)}^T {\left({RI_B}\right)} {\left(R{\vec{\omega}}_B\right)} = \frac{1}{2} {\vec{\omega}_B}^T {R^T} {\left({RI_B}\right)} {\left(R{\vec{\omega}}_B\right)} = \frac{1}{2} {\vec{\omega}_B}^T {I_B} {\left(R{\vec{\omega}}_B\right)} \neq T_B##

    It's nice to read this in a different light. Makes sense!

    Been there, done that. Boy those were the good 'ol days. Well, thank goodness for Matlab!

    With my ME background I never (well, barely) exposed to 3D dynamics. Just in passing in other non-ME classes (usually aero), which makes me kind of wish I went the AA route since that is what interested me. I focused on dynamics and control theory in my undergrad and grad schooling, but didn't do much implementation. Anyways, getting off topic. Using energy method (Lagrange), I found the formulation of the dynamics for this problem straight forward using the Euler angles...then easily implemented in a numerical solver. My understanding was Euler angles and quaternions (no experience with quaternions) were pretty common for spacecraft attitude dynamics, but like I said my experience is lacking.

    This makes sense and is what I've seen from various sources. I just have something screwy which is giving me problems.

    I skipped right onto energy methods because I knew applying Newtonian mechanics would be a chore :eek:
  5. May 21, 2013 #4

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    No, your problem lies with using Euler angles. "Euler angles are evil", and this is just one of many ways in which they are evil. An Euler ZXZ sequence with constant Euler rates (your ##\dot{\alpha}##, ##\dot{\beta}##, and ##\dot{\gamma}##) in general results in non-constant angular velocity, and a constant angular velocity in general results in non-constant Euler rates. For your sequence, the angular velocity will be
    [tex]\vec{\omega} =
    \dot{\alpha}\sin\beta\sin\gamma + \dot{\beta}\cos\gamma \\
    \dot{\alpha}\sin\beta\cos\gamma - \dot{\beta}\sin\gamma \\
    \dot{\alpha}\cos\beta + \dot{\gamma}
    Note: I could have the above back-asswards; Euler angles are evil after all.

    Applying the above to a sequence with constant, non-zero ##\dot{\alpha}##, ##\dot{\beta}##, and ##\dot{\gamma}## results in a time-varying angular velocity. The above set of equations is reversible with one caveat (##\sin\beta \ne 0##): The Euler rates can be expressed in terms of the angular velocity and and Euler angles. A constant angular velocity in general results in non-constant Euler rates.

    That caveat ##\sin\beta \ne 0## yet another reason why Euler angles are evil. Every one of the twelve sequences (e.g., XYX, ZXZ, XYZ, ...) suffers a phenomenon called gimbal lock. In the case of your ZXZ sequence, gimbal lock occurs when ##\sin\beta = 0##. Numerically you'll run into trouble when ##\sin\beta## is merely close to zero rather than identically equal to zero.
  6. May 21, 2013 #5
    Well duh! I should have realized that. Thanks for pointing out the obvious. That is the same expression I have for the angular velocity described in body frame coordinates, btw.

    I figured I would run into the singularity issue sooner or later. So, given all of this, what are your suggestions? Start using quaternions which don't have the singularity issue?
  7. May 22, 2013 #6

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    Sorry for the belated response. I have some pressing business in my real life job as of late. To make matters worse, I had an all-day class yesterday on an extremely mundane topic. The class started at 8 AM and they didn't supply coffee. That's downright criminal. I had no change for the vending machine, and my wallet contained exactly $20, in the form of a single $20 bill. (The saga continues today. Today I will be prepared with coins and small bills for the vending machines.)

    Quaternions (unit quaternions) are a very handy tool for representing rotations/transformations in three space. You need to beware that that is a rabbit hole that quickly leads to a land that makes Alice's Wonderland look very mundane.

    A good place to start is the book Quaternions and Rotation Sequences: A Primer With Applications to Orbits, Aerospace, and Virtual Reality by J.B. Kuipers. A couple of bad places to start are wikipedia and mathworld. The mathworld entries are pretty much placeholder pages that are more or less void of content. Wikipedia used to have good pages on rotations/transformations in three space, but that is no longer the case.

    Note: I've written a number of posts on unit quaternions and their use for representing rotations/transformations. Those might be of use to you.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook