Angular acceleration and velocity in 3D

Click For Summary
SUMMARY

This discussion focuses on the implementation of angular acceleration and velocity in a rigid-body physics program using quaternions. The author emphasizes the importance of quaternion representation, specifically preferring left quaternions for their prevalence at NASA JSC. Key equations include the quaternion derivative and its propagation using exponential forms, with a strong recommendation against using the Euler method due to its instability and energy conservation issues. Normalization of quaternions after each time step is also highlighted as a crucial step in maintaining unit quaternion integrity.

PREREQUISITES
  • Understanding of rigid-body dynamics and physics programming
  • Familiarity with quaternion mathematics and representation
  • Knowledge of angular velocity and acceleration concepts
  • Experience with numerical methods for simulation, particularly quaternion propagation
NEXT STEPS
  • Research quaternion mathematics and its applications in 3D rotations
  • Learn about quaternion normalization techniques in physics simulations
  • Explore alternative numerical integration methods beyond Euler's method
  • Investigate the implementation of angular motion equations in rigid-body simulations
USEFUL FOR

Physics programmers, game developers, and engineers working on simulations involving rigid-body dynamics and 3D rotations will benefit from this discussion.

Alkatran
Science Advisor
Homework Helper
Messages
959
Reaction score
0
I'm trying to write a small rigid-body physics program. I already have the linear forces part done, using Euler's method. This makes it easy to take the current forces and compute the next position.

The issue I'm having is that I don't know how to get the next angular position/velocity from the current torques on the body. If I use quaternions for torque, velocity and orientation, do I just left-multiply my torque rotation quaternions together, then use that to rotate my velocity, then use that to rotate my position?
 
Physics news on Phys.org
First, a word of caution regarding quaternions for rotations. There are many ways to do this. Quaternions can be represented by a scalar and an imaginary vector: [tex]\mathcal Q = \bmatrix q_s \\ \boldsymbol q_v \endbmatrix[/tex]

Suppose [tex]\mathcal Q[/tex] is a unit quaternion. Both of the following forms transform a vector in [tex]\mathbb R^3[/tex]:

[tex]\bmatrix 0 \\ \boldsymbol x_{rot}\endbmatrix =<br /> \mathcal Q<br /> \bmatrix 0 \\ \boldsymbol x \endbmatrix<br /> \mathcal Q^\star[/tex]

[tex]\bmatrix 0 \\ \boldsymbol x_{rot}\endbmatrix =<br /> \mathcal Q^\star<br /> \bmatrix 0 \\ \boldsymbol x \endbmatrix<br /> \mathcal Q[/tex]

The difference between the two forms is whether the the unconjugated quaternion is on the left or the right, hence the terminology left and right quaternions. Some people prefer left quaternions because they chain right to left, exactly the way transformation matrices chain (a good thing). Others prefer right quaternions because they chain left-to-right, which is intuitively more obvious. Those people see the right-to-left chaining of transformation matrices as goofy and something to be discarded. Both sides are often guilty of being unaware that there are two ways to do this. So beware. You have to scrutinize any books or papers you reference to make sure you and the reference are in sync.

BTW, I use left quaternions. They are by far the more prevalent form at NASA JSC. (Marshall uses right quaternions, so go figure.)

Now, about the rotational equations of motion. Denote the attitude quaternion, rotation rate, and rotational acceleration of some body with respect to inertial as [tex]\mathcal Q_{I\to B}[/tex], [tex]\boldsymbol \omega_{B:I\to B}[/tex], and [tex]\dot \boldsymbol \omega_{B:I\to B}[/tex]. The B: denotes that the vectors are expressed in the body frame rather than inertial. Vehicles need to know their angular velocity in their own frame, and torques typically arise in the body frame. It is very convenient to represent angular velocity and acceleration in the body frame. However, it is a rotating frame. Since the body frame is rotating, the angular acceleration includes a rotating frame term as well as terms from external torques.

The quaterion derivative is

[tex]\frac d{dt} \mathcal Q_{I\to B} =<br /> -\;\frac 1 2\bmatrix 0 \\ \boldsymbol \omega_{B:I\to B}\endbmatrix<br /> \mathcal Q_{I\to B}[/tex]

How to propagate? The above form obviously suggests an exponential form (using the quaternion exponential function!):

[tex]\mathcal Q_{I\to B}(t+\delta t) \approx<br /> \exp\left(\frac d{dt} \mathcal Q_{I\to B}(t) \delta t\right)<br /> \mathcal Q_{I\to B}(t)[/tex]

However, if the time steps are sufficiently small, a linear approximation can be used since the quaternion exponential behaves analogously to the complex and real exponential:

[tex]\mathcal Q_{I\to B}(t+\delta t) \approx<br /> (1+\frac d{dt} \mathcal Q_{I\to B}\delta t) \mathcal Q_{I\to B}(t)[/tex]

One problem with this is that the result is not a unit quaternion. There is a simple solution: normalize the quaternion after each time step.

I will leave the second derivative as an exercise for the reader.

Another word of caution: If you are propagating the quaternion derivative (rather than angular velocity) will need to enforce the fact that the quaternion derivative is normal to the quaternion. The inner product of any constant length vector and its derivative is identically zero.

A final word of caution: Don't use the Euler method. It is never stable. It does not conserve energy. It loses accuracy incredibly quickly. It is easy to understand, which is why it is taught. Learn it and then never, ever, ever, ever use it.
 
Last edited:

Similar threads

  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 30 ·
2
Replies
30
Views
5K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 9 ·
Replies
9
Views
1K
Replies
1
Views
1K
  • · Replies 138 ·
5
Replies
138
Views
9K