Attitude Kinematics
Attitude Kinematics
Attitude Kinematics
kinematics
~r˙ = ~p/m
kinetics
~p˙ = ~f
3 / 63
Translational vs Rotational
4 / 63
Back to Reference Frames
Denote frames as triads of mutually orthogonal unit vectors:
ECI Orbital Body-Fixed
{î1 ,î2 ,î3 } {ô1 ,ô2 ,ô3 } {b̂1 ,b̂2 ,b̂3 }
Fi Fo Fb
6 / 63
Vectors
A vector, ~v, is an abstract mathematical object with two
properties: length or magnitude, ||~v||, and direction
~v = v1 î1 + v2 î2 + v3 î3
Scalars, v1 , v2 , and v3 , are the components of ~v expressed in Fi .
v = v2
v3
7 / 63
Vector Notation Summary
Throughout the course, we will work with vectors and with their
representations in several reference frames.
viT R = vbT
I Transpose both sides to obtain RT vi = vb
I So RT transforms vectors from Fi to Fb
9 / 63
Rotations (continued)
10 / 63
Rotations (continued)
I Can also write the rotation matrix as the dot product of two
“vectrices”: n o n oT
R = î · b̂
I Can show that the inverse of a rotation matrix is simply its
transpose
R−1 = RT
I Thus a rotation matrix is an orthonormal matrix: its rows and
columns are components of mutually orthogonal unit vectors
I Introduce superscripts bi to denote rotation from Fi to Fb
vb = Rbi vi
Think of the “i” superscript on R as cancelling with the “i”
subscript on v
T
I Similarly vi = Rib vb , where Rib = Rbi
11 / 63
Rotation Notation
As matrix with rows and columns being unit vectors of one frame
expressed in the other
îT
1b
h i
ib T T T
R = îT = b̂ b̂ b̂
2b 1i 2i 3i
îT
3b
12 / 63
An Example
The reference frame Fb has the following unit vectors in Fi . What are the
rotation matrices Rbi and Rib ?
The direction cosines can be identified by inspection. For Rbi , the components
of the b̂ vectors in Fi go in the rows.
−0.4063 −0.3994
" #
0.8218
bi
R = 0.2490 0.8867 −0.3896
0.5125 0.2207 0.8299
For Rib , the components of the b̂ vectors in Fi go in the columns. That is,
T
Rib = Rbi " #
0.8218 0.2490 0.5125
ib
R = −0.4063 0.8867 0.2207
−0.3994 −0.3896 0.8299
13 / 63
Attitude Kinematics Representations
14 / 63
Aircraft Roll, Pitch, and Yaw
15 / 63
Spacecraft Roll, Pitch, and Yaw
16 / 63
Ship Roll, Pitch, and Yaw
19 / 63
Rotation from Fi to Fi0
20 / 63
Rotation from Fi to Fi0 Direction Cosines
By inspection, we can write down the Fi0 vectors in terms of θ1
and the Fi vectors, noting that î03 = î3
21 / 63
Rotation from Fi to Fi0 Rotation Matrix
Since î3 and î03 are in the same direction, we can easily write the
0
rotation matrix R3 (θ1 ) = Ri i
Note that the minus sign in R3 (θ1 ) is in the row above the row
with a 1 in it.
R2 (θ2 ) = 0 1 0
Denote resultingnintermediate
o sin θ2 0 cos θ2
frame as Fi00 or î00
Note that the minus sign in
Rotation matrix is R2 (θ2 ) is in the row above the
R2 (θ2 ) = Ri
00 i0
⇒ vi00 = Ri
00 i0
vi0 row with a 1 in it.
Now we can rotate from Fi to
Note well: Rotation matrix Fi00
notation for “simple”rotations is
Ri (θj ), where subscript i denotes vi00 = R2 (θ2 )vi0 = R2 (θ2 )R3 (θ1 )vi
ith axis and subscript j denotes
jth rotation in three-Euler Angle
Keep in mind that we are
sequence
building Rbi .
23 / 63
Third Rotation: Fi00 to Fb
Third rotation can be about Note that minus sign in R1 (θ3 ) is
either “1” or “3” axis in bottom row, which should be
viewed as being “above” row with 1.
Choose “1” axis, î001 , through θ3
Note also that minus sign in all
Denoten resulting
o “final” frame as cases is on sine.
Fb or b̂
The pattern is:
Rotation matrix is 1) 1 on diagonal corresponding to
axis;
00 00
R1 (θ3 ) = Rbi ⇒ vb = Rbi vi00 2) 0 on off-diagonal elements of row
and column with 1;
By inspection, the rotation 3) cosines on remaining diagonal
matrix is elements;
4) sines on remaining off-diagonal
1 0 0
elements;
R1 (θ3 ) = 0 cos θ 3 sin θ3
5) minus sign on sine in row above
0 − sin θ3 cos θ3 1.
24 / 63
An Example
Reference frame Fa is transformed into reference frame Fb by performing a
3-1-2 Euler rotation sequence through the angles θ1 , θ2 , and θ3 .
Note that the order of simple rotation matrices in an Euler angle sequence is
from left to right:
Third rotation × Second rotation × First rotation
25 / 63
An Example (continued): Rotation Matrix to Euler Angles
26 / 63
An Example (continued): Some numbers
For θ1 = 30◦ , θ2 = −60◦ , θ3 = 45◦ , we have
−0.1768 −0.3536
" #
0.9186
ba
R = R2 (θ3 )R1 (θ2 )R3 (θ1 ) = −0.2500 0.4330 −0.8660
0.3062 0.8839 0.3536
Using the equations for backing out θi , we obtain directly
θ1 = 30◦ , θ2 = −60◦ , and θ3 = 45◦
% R = R1(angle)
% returns elementary "1" rotation matrix
function Rotmat = R1(angle)
c = cos(angle); s = sin(angle);
Rotmat = [ 1 0 0; 0 c s; 0 -s c ];
27 / 63
An Example (continued): Different numbers
For θ1 = 30◦ , θ2 = 120◦ , θ3 = 45◦ , we have
0.3062 0.8839 0.3536
Rba = R2 (θ3 )R1 (θ2 )R3 (θ1 ) = 0.2500 −0.4330 0.8660
0.9186 −0.1768 −0.3536
Using the equations for backing out θi , we obtain directly
θ1 = −150◦ , θ2 = 60◦ , and θ3 = −135◦
Note that these three angles are NOT the same as the three
angles we used to compute Rba
Check by calculating R2 (θ3 )R1 (θ2 )R3 (θ1 ) using these three
angles, and you will find that you obtain the same Rba
Roll, pitch and yaw are Euler angles and are sometimes defined as
a 3-2-1 sequence and sometimes defined as a 1-2-3 sequence
What’s the difference?
The 3-2-1 sequence (we did earlier) leads to
−sθ2
cθ1 cθ2 sθ1 cθ2
bi
R = −cθ3 sθ1 + cθ1 sθ2 sθ3 cθ1 cθ3 + sθ1 sθ2 sθ3 cθ2 sθ3
cθ1 sθ2 cθ3 + sθ1 sθ3 sθ1 sθ2 cθ3 − cθ1 sθ3 cθ2 cθ3
where θ1 is yaw angle, θ2 is pitch angle, and θ3 is roll angle
Rbi = cθ2 sθ3 cθ1 cθ3 − sθ1 sθ2 sθ3 sθ1 cθ3 + cθ1 sθ2 sθ3
sθ2 −sθ1 cθ2 cθ1 cθ2
where θ1 is roll angle, θ2 is pitch angle, and θ3 is yaw angle
30 / 63
Roll, Pitch, and Yaw (continued)
However, if we assume that angles are small (appropriate for many vehicle
dynamics problems), then approximations of the two matrices are equal
3-2-1 Sequence 1-2-3 Sequence
cos θ ≈ 1 and sin θ ≈ θ cos θ ≈ 1 and sin θ ≈ θ
1 θ1 −θ2 1 θ3 −θ2
⇒ Rbi ≈ −θ1 1 θ3 ⇒ Rbi ≈ −θ3 1 θ1
θ2 −θ3 1 θ2 −θ1 1
θ1 is yaw, θ2 is pitch, and θ3 is roll θ1 is roll, θ2 is pitch, and θ3 is yaw
× × ×
θ3 roll θ1
Rbi ≈ 1 − θ2 ⇒ Rbi ≈ 1 − pitch ⇐ Rbi ≈ 1 − θ2
θ1 yaw θ3
Thus, roll, pitch, and yaw are the same for 1-2-3 and 3-2-1 sequences, if
the angles are small and a linear approximation is valid.
31 / 63
What You Need To Know About Euler Angles
32 / 63
Euler’s Theorem
The complexity of using many trig and inverse trig functions leads
us to Euler’s Theorem:
33 / 63
Observations Regarding a and Φ
This fact justifies the term eigenaxis for the Euler axis.
34 / 63
Extracting a and Φ from R
35 / 63
Another Four-Parameter Set: Quaternions
We know how to calculate R from Euler axis and angle and vice
versa.
1√
q4 = ± 1 + trace R
2
R − R32
1 23
q = R31 − R13
4q4 R − R
12 21
You must be able to compute one from the other for any given
representation
Next: How does attitude vary with time?
38 / 63
Dynamics = Kinematics + Kinetics
kinematics
~r˙ = ~p/m
kinetics
~p˙ = ~f
40 / 63
Translational vs Rotational
41 / 63
Differential Equations of Kinematics
Given the velocity of a point mass and initial conditions for its
position, we can compute its position as a function of time by
integrating the differential equation:
~r˙ = ~v
We now need to develop the equivalent differential equations for
the attitude when the angular velocity is known.
Sneak Preview
0 sin θ3 / cos θ2 cos θ3 / cos θ2 ω1
θ̇ = 0 cos θ3 − sin θ3 ω2 = S−1 ω
1 sin θ3 sin θ2 / cos θ2 cos θ3 sin θ2 / cos θ2 ω3
q× + q4 1
Φ̇ = aTω 1
q̄˙ = ω = Q(q̄)ω
2 −qT
1 × Φ × ×
ȧ = a − cot a a ω
2 2
42 / 63
Euler Angles and Angular Velocity
0
00 i0 i00 i0 i00 i0
~i
ω = θ̇2 î002 = θ̇2 î02 ω i00 =ω i0 = θ̇2
0
θ̇3
bi00 bi00 bi00
~
ω = θ̇3 b̂1 = θ̇3 î001 ωb =ω i00 = 0
0
00 00 i0 0
~ bi = ω
Add the angular velocity vectors: ω ~ bi + ω
~i ~i i
+ω
00 0 0
Rotate ωii00 i from Fi00 to Fb , and ωii0 i from Fi0 to Fi00 to Fb .
00 i0 00 00 0
ωib = Rbi ωii00 i
0 00 00 i0 0
ωib i = Rbi Ri ωii0 i
Carry out matrix multiplications and complete addition, keeping in
mind 3-2-1 Euler angle sequence.
44 / 63
Completing the Operation
Carry out the matrix multiplications and add the three results:
1 0 0 0 0
00 0
ωib i = 0 cos θ3 sin θ3 θ̇2 = cos θ3 θ̇2
0 − sin θ3 cos θ3 0 − sin θ3 θ̇2
0
1 0 0 cos θ2 0 − sin θ2 0
ωib i = 0 cos θ3 sin θ3 0 1 0 0
0 − sin θ3 cos θ3 sin θ2 0 cos θ2 θ̇1
− sin θ2 θ̇1
= cos θ2 sin θ3 θ̇1
cos θ2 cos θ3 θ̇1
Completing the addition and writing as a matrix expression, we obtain
− sin θ2 0 1 θ̇1
ωbi
b =
cos θ2 sin θ3 cos θ3 0 θ̇2
cos θ2 cos θ3 − sin θ3 0 θ̇3
This result is the angular velocity of Fb with respect to Fi , expressed in
Fb , also written as ωbi
b = S(θ)θ̇.
45 / 63
Completing the Operation (continued)
θ̇ = = S−1 (θ)ω
0 sin θ3 / cos θ2 cos θ3 / cos θ2 ω1
= 0 cos θ3 − sin θ3 ω2
1 sin θ3 sin θ2 / cos θ2 cos θ3 sin θ2 / cos θ2 ω3
This result is the kinematic differential equation for rotational motion in
terms of 3-2-1 Euler angles.
I Note that for 3-2-1 Euler angle set, the Euler rates go to
infinity when cos θ2 → 0
I The reason is that at θ2 = π/2 (or 3π/2) the first and second
rotations are indistinguishable
I For the “symmetric” Euler angle sequences (3-1-3, 2-1-2,
1-3-1, etc) the singularity occurs when θ2 = 0 or π
I For the “asymmetric” Euler angle sequences (3-2-1, 2-3-1,
1-3-2, etc) the singularity occurs when θ2 = π/2 or 3π/2
I This kinematic singularity is a major disadvantage of using
Euler angles for large-angle motion
I For example, for Roll-Pitch-Yaw Euler angles, the singularity is
when the Pitch angle is π/2 or 3π/2; for an airplane, this
condition corresponds to a vertical ascent or descent
47 / 63
What You Need To Know ...
48 / 63
Euler Axis/Angle and Euler Parameters
Later we will learn how to get the angular velocity from the
kinetics differential equation:
ω̇ = −I−1 ω× Iω + I−1 g
49 / 63
Typical Problem Involving Angular Velocity and Attitude
Given initial conditions for the attitude (in any form), and a time
history of angular velocity, compute R(t) or any other attitude
representation as a function of time
Examples:
Given Euler angle sequence, θ(t0 ), and ω(t), integrate θ̇ = S−1 (θ)
and compute R(θ(t))
50 / 63
Problem 1
51 / 63
Problem 1 (Matlab Code)
thetaABdeg = mod(thetaAB,360)
53 / 63
Problem 2
54 / 63
Problem 2 (Matlab code)
% Extract the Euler angle and Euler axis from this matrix
cosPhi = (trace(RBi)-1)/2;
Phi = acos(cosPhi);
sinPhi = sin(Phi);
askew = (RBi’-RBi)/(2*sinPhi);
a = [askew(3,2); askew(1,3); askew(2,1)]
% It works, so let’s show the results, with angle in rad and deg
Phirad = Phi
Phideg = Phi*180/pi
55 / 63
Problem 3
Matlab produces the following plot using the default settings. Clearly this plot
is not as useful as it could be. Fortunately, Matlab allows the user to make
modifications to the plots.
57 / 63
Problem 3 (Plot 2)
Changing the linewidth and fontsize parameters, adding labels and legends,
produces a more satisfying plot of the Euler angles vs time.
60 / 63
Problem 4 (Plot)
61 / 63
Summary
Learning Objective 1. Describe attitude kinematics using reference frames,
rotation matrices, Euler parameters, Euler angles, and quaternions.
63 / 63