attitude representation - · pdf fileaxis-angle representation euler’s theorem states...
TRANSCRIPT
Attitude Representation
Basilio Bona
DAUIN – Politecnico di Torino
Semester 1, 2015-16
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 1 / 32
Mathematical preliminaries
A 3D rotation matrix
R =[r1 r2 r3
]= [rij ]
contains only three independent parameters that represent the attitude(aka orientation) of the body-frame with respect to some fixed/inertialframe.
We indicate these parameters as α =[α1 α2 α3
]T.
they can be described in different ways: some consist in just three angles,with various names and meanings, other representations use more thanthree parameters, but add some constraints that reduce to three thenumber of independent parameters.
Each representation has positive and negative characteristics.
In the following we will introduce the most common ways to describe theattitude of a rigid body.
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 2 / 32
Direction cosines
Direction cosines coincide with the 9 elements of the rotation matrix Ritself.
R contains in its columns ri (or rows) the representation of the unit basisvectors of the local frame with respect to the world frame; since thisrepresentation is a scalar product, and both vectors are unit vectors, theresult is the cosine of the angle between the two basis vectors.
This representation consists of nine parameters constrained by sixorthogonality constraints; in a cartesian reference frame the angles are all90◦, so that ri rj = 0 if i 6= j and ri ri = 1, therefore only three freeparameters result.
The parameters[α1 α2 α3
]Tare hidden in R but can be extracted
using inverse trigonometric relations that depend on how α are chosen.
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 3 / 32
Axis-angle representation
Euler’s theorem states that the composition of any number of rotations isequivalent to a single rotation of an angle θ around an axis represented by
the unit vector u =[u1 u2 u3
]T, ‖u‖= 1.
The axis-angle representation is given by the following rotation matrix:
Rot(u,θ) = u21 (1− cθ ) + cθ u1u2 (1− cθ )−u3sθ u1u3 (1− cθ ) +u2sθ
u1u2 (1− cθ ) +u3sθ u22 (1− cθ ) + cθ u2u3 (1− cθ )−u1sθ
u1u3 (1− cθ )−u2sθ u2u3 (1− cθ ) +u1sθ u23 (1− cθ ) + cθ
where
cθ ≡ cosθ sθ ≡ sinθ
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 4 / 32
Axis-angle representation
Given the rotation matrix R, the rotation angle θ is computed as follows:
θ =±arccos
(tr (R)−1
2
)If R 6= RT, the unit vector u can be obtained building theskew-symmetrical matrix and computing the ui terms as follows
S(u)≡
0 −u3 u2u3 0 −u1−u2 u1 0
=1
2sinθ
(R−RT
)
If R = RT then S(u) = O; we have two cases:
Case 1. R = RT = I
Since sinθ = 0±2kπ, θ is set to zero and u is undetermined, since norotation occurs.
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 5 / 32
Axis-angle representation
Case 2. R = RT 6= I
It follows that RTR = RRT = RR = R2 = I. This means that after tworotations of the same angle θ around the same axis u the orientation isgiven by the identity matrix, i.e., a null rotation; this implies 2θ = 0±2π
and θ =±π.
In order to find u, we compute S2(u) as
S2 =1
1− cosθ
(R+RT
2− I
)
and then we equate it to the symbolic relation
S2 = uuT− I =
u21−1 u1u2 u1u3u2u1 u22−1 u2u3u3u1 u3u2 u23−1
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 6 / 32
Cardan angles
Cardan angles
Each rotation matrix R can built by the composition of three elementaryrotations
R = Rot(u1,α1)Rot(u2,α2)Rot(u3,α3)
where u1,u2,u3 are a proper choice of the unit vectors u` ∈ {i, j,k}.The only constraint is that u1 6= u2 or u2 6= u3, since
Rot(u`,α1)Rot(u`,α2) = Rot(u`,α1 + α2)
leads to only one elementary rotation.
The are twelve admissible combinations of rotations that form the set ofCardan angles.
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 7 / 32
Cardan angles
1) R(i,θ1)R(j,θ2)R(k,θ3) RPY angles 2
2) R(i,θ1)R(k,θ3)R(j,θ2)
3) R(j,θ2)R(i,θ1)R(k,θ3)
4) R(j,θ2)R(k,θ3)R(i,θ1)
5) R(k,θ3)R(i,θ1)R(j,θ2)
6) R(k,θ3)R(j,θ2)R(i,θ1) RPY angles 1
7) R(i,α)R(j,β )R(i,γ)
8) R(i,α)R(k,β )R(i,γ)
9) R(j,α)R(i,β )R(j,γ)
10) R(j,α)R(k,β )R(j,γ)
11) R(k,α)R(i,β )R(k,γ) Euler angles 1
12) R(k,α)R(j,β )R(k,γ) Euler angles 2
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 8 / 32
Euler angles
Among the Cardan angles, the most familiar are the Euler angles(ϕ,θ ,ψ), that have the following (implicit) parametrization:
Rφ ,θ ,ψ = R(φ ,θ ,ψ) = Rz ,φRx ,θRz ,ψ = R(k,φ)R(i,θ)R(k,ψ)
=
cφ cψ − sφ cθ sψ −cφ sψ − sφ cθ cψ sφ sθ
sφ cψ + cφ cθ sψ −sφ sψ + cφ cθ cψ −cφ sθ
sθ sψ sθ cψ cθ
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 9 / 32
Euler angles
Figure: Euler angles.
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 10 / 32
Euler angles
To compute the Euler angles from a generic rotation matrix defined as:
R =
r11 r12 r13r21 r22 r23r31 r32 r33
where the elements rij are known, it is necessary to solve the following nonlinear system of equations:
r11 = cφ cψ − sφ cθ sψ
r12 =−cφ sψ − sφ cθ cψ
r13 = sφ sθ
r21 = sφ cψ + cφ cθ sψ
r22 =−sφ sψ + cφ cθ cψ
r23 =−cφ sθ
r31 = sθ sψ
r32 = sθ cψ
r33 = cθ
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 11 / 32
Euler angles
The solution is obtained as follows
φ = atan2(r13, −r23)±2kπ
ψ = atan2(−cφ r12− sφ r22, cφ r11 + sφ r21
)±2kπ
θ = atan2(sφ r13− cφ r23, r33
)±2kπ
it is important to use the inverse trigonometric function atan2(y ,x)
θ = atan2(y ,x) = tan−1(yx
)=
=
0◦ ≤ θ ≤ 90◦ se x ≥ 0; y ≥ 0
90◦ ≤ θ ≤ 180◦ se x ≤ 0; y ≥ 0−180◦ ≤ θ ≤ −90◦ se x ≤ 0; y ≤ 0−90◦ ≤ θ ≤ 0◦ se x ≥ 0; y ≤ 0
since it is more robust from a numerical point of view
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 12 / 32
Roll-Pitch-Yaw angles
Another rather common parametrization id based on the Roll, Pitch, Yaw(RPY) angles (θx ,θy ,θz), also known as Tait-Bryant angles, defined asfollows
Rθx ,θy ,θz = R(θx ,θy ,θz) = Rz ,θzRy ,θyRx ,θx = R(k,θz)R(j,θy )R(i,θx)cθz cθy sθx sθy cθz − cθx sθz cθx sθy cθz + sθx sθz
cθy sθz sθx sθy sθz + cθx cθz cθx sθy sθz − sθx cθz
−sθy sθx cθy cθx cθy
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 13 / 32
Roll-Pitch-Yaw angles
Figure: RPY angles.
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 14 / 32
RPY angles
The RPY angles are obtained from a generic rotation matrix as:
θx = atan2(r32, r33)±2kπ
θz = atan2(−cθx r12 + sθx r13, cθx r22− sθx r23)±2kπ
θy = atan2(−r31, sθx r32 + cθx r33)±2kπ
Other RPY definitions are possible and found in technical literature, as
Rθz ,θy ,θx = R(θz ,θy ,θx) = Rx ,θxRy ,θyRz ,θz = R(i,θx)R(j,θy )R(k,θz) cθy cθz −cθy sθz sθy
sθx sθy cθz + cθx sθz −sθx sθy sθz + cθx cθz −sθx cθy
−cθx sθy cθz + sθx sθz cθx sθy sθz + sθx cθz cθx cθy
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 15 / 32
R =0.6124 -0.3536 0.70710.6124 -0.3536 -0.70710.5000 0.8660 0
eul =45.0000 90.0000 30.0000
Reul =0.6124 -0.3536 0.70710.6124 -0.3536 -0.70710.5000 0.8660 0
rpy =90.0000 -30.0000 45.0000
Rrpy =0.6124 -0.3536 0.70710.6124 -0.3536 -0.70710.5000 0.8660 0
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 16 / 32
Cardan angles singularities
The sequence of three angles produces a singularity when a certainpattern of angles appears. For the first group of cardan angles thepresence of a ±90◦ angle may produce a singular behaviour, since
R(i,θx)R(j,90◦) = R(j,90◦)R(k,θx)
R(i,θx)R(k,−90◦) = R(k,−90◦)R(j,θx)
R(j,θy )R(k,90◦) = R(k,90◦)R(i,θy )
R(j,θy )R(i,−90◦) = R(i,−90◦)R(k,θy )
R(k,θz)R(i,90◦) = R(i,90◦)R(j,θz)
R(k,θz)R(j,−90◦) = R(j,−90◦)R(i,θz)
(1)
The problem of gimbal lock is due to these singularities.
For the second group of cardan angles it is sufficient that the middlerotation matrix is equal to the identity matrix to give origin to a singularrepresentation.
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 17 / 32
Singularities – Euler angles
When r33 = cθ =±1 the matrix R(φ ,θ ,ψ) reduces to
R(k,φ)R(k,ψ) = R(k,(φ + ψ))
that is function of a single angle.
In this case we say that the Euler representation is singular; of the threepossible angles we have only θ = 0±π and γ = (φ + ψ); we cannotcompute separately the two angles φ and ψ, but only their sum.
This situation is described saying that θ does not decouple the other tworotations and a singular configuration results.
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 18 / 32
Singularities – RPY angles
Roll-Pitch-Yaw angles are subject to singularity too, as the followingrelations hold
R(k,θz)R(j,90◦) = R(j,90◦)R(i,θz) (2)
R(i,θx)R(j,90◦) = R(j,90◦)R(k,θx) (3)
When θy = 90◦ the zyx RPY matrix becomes singular, since
R(k,θz)R(j,90◦)R(i,θx) =R(j,90◦)R(i,θz)R(i,θx) =R(j,90◦)R(i,(θx +θz))
and also the xyz RPY matrix becomes singular, since
R(i,θx)R(j,90◦)R(k,θz) =R(j,90◦)R(k,θx)R(k,θz) =R(j,90◦)R(k,(θx +θz))
Both representation are now functions of only a combination of twoangles; this fact is the cause of the so called gimbal-lock problem thatoccurs in gyroscopes and is well known since the incident on the Apollo 10Manned Lunar Spacecraft.
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 19 / 32
Euler parameters
Given a rotation matrix R(u,θ), of angle θ around u =[u1 u2 u3
]T,
Euler parameters (v1,v2,v3,v4) are defined as follows:
v1 = u1 sinθ
2, v2 = u2 sin
θ
2, v3 = u3 sin
θ
2, v4 = cos
θ
2
they shall not be confused with the Euler angles
Only three parameters are independent since:√4
∑i=1
v2i = 1
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 20 / 32
Euler parameters
Given the Euler parameters vi , the corresponding rotation matrix is:
R(v) =
v21 −v22 −v23 + v24 2(v1v2−v3v4) 2(v1v3 + v2v4)2(v1v2 + v3v4) −v21 + v22 −v23 + v24 2(v2v3−v1v4)2(v1v3−v2v4) 2(v2v3 + v1v4) −v21 −v22 + v23 + v24
Given the rotation matrix R = [rij ], the correponsing Euler parameters viare:
v4 =±1
2
√(1 + trR) sign ambiguity cancelled if −π ≤ θ ≤ π
v1 =1
4v4(r32− r23)
v2 =1
4v4(r13− r31)
v3 =1
4v4(r21− r12)
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 21 / 32
Euler parameters
Euler parameters can be computed from the Euler angles as follows:
v1 = sin(
φ−ψ
2
)sin(
θ
2
)v2 = cos
(φ−ψ
2
)sin(
θ
2
)v3 = sin
(φ+ψ
2
)cos(
θ
2
)v4 = cos
(φ+ψ
2
)cos(
θ
2
)The sign ambiguity in v4 can be cancelled assuming the constraint:
−π
2≤ θ
2≤ π
2,
or −π ≤ θ ≤ π; in this way the parameter v4 can only be positive.
The rotation angle is computed as cosθ = v24 − (v21 +v22 +v23 ) and the unitvector u as
u =1
sin(θ/2)
v1v2v3
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 22 / 32
Euler parameters
Euler parameters parametrization is very convenient: it is more compactthan the rotation matrix R, and numerically more robust than the Eulerangles, since to compute R = R(v) we do not need trigonometricfunctions.
Moreover, given two rotations R(va) and R(vb), the Euler parameters ofthe product R(vc) = R(va)R(vb) are computed by the following matrixproduct (see also the matrix form of the quaternion product):
vc = F(va)vb =
va4 −va3 va2 va1va3 va4 −va1 va2−va2 va1 va4 va3−va1 −va2 −va3 va4
vb
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 23 / 32
Quaternions
See the slides devoted to QUATERNIONS
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 24 / 32
Quaternions
The unit quaternion
u = (u0,u1,u2,u3) = (u0,u) = cosθ +usinθ
represents the rotation Rot(u,2θ) around the axis specified by the unit
vector u =[u1 u2 u3
]TQuaternions and elementary rotations
R(i,α)→ ux = (cosα/2, sinα/2, 0, 0)
R(j,β )→ uy = (cosβ/2, 0, sinβ/2, 0)
R(k,γ)→ uz = (cosγ/2, 0, 0, sinγ/2)
The “vectorial base” of quaternions correspond to elementary rotations ofπ around the principal axes
i = (0,1,0,0) → R(i,π)j = (0,0,1,0) → R(j,π)k = (0,0,0,1) → R(k,π)
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 25 / 32
Rotation vectors
Instead of using the Euler parameters or the quaternions, that require fourparameters and one constraint, we can use the so called rotation vectorsr, whose ri components describe the rotation axis and whose norm ‖r‖provides the rotation angle, or a trigonometric function of the angle.
In general the rotation vector r is defined as
r = f (θ)u
where u is the unit vector characterizing the rotation axis and ‖r‖= f (θ)is an odd function.
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 26 / 32
Rodrigues vectors
The most common f (θ) odd functions are:
a) f (θ) = θ
b) f (θ) = sinθ
c) f (θ) = sin θ
2
c) f (θ) = tan θ
2
The choice c) defines the Euler (rotation) vector
rE = sinθ
2
[u1 u2 u3
]Tnot to be confused with Euler parameter or Euler angles.
Euler rotation vectors have a strict relation with quaternions.
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 27 / 32
Rodrigues vectors
The choice d) defines the Rodrigues (or Gibbs) rotation vector
rR = tanθ
2
[u1 u2 u3
]TRodrigues vector rR =
[r1 r2 r3
]Tand Euler parameters (v1,v2,v3,v4)
are related as follows:
r1 =v1v4
, r2 =v2v4
, r2 =v3v4
Rodrigues vectors are undefined for angles θ = (2k±1)π.
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 28 / 32
Rodrigues vectors
Given the rotation matrix R, the Rodrigues vector rR =[r1 r2 r3
]Tis
obtained from the elements of a skew-symmetric matrix S(r)
S(r) =
0 −r3 r2r3 0 −r1−r2 r1 0
=R−RT
1 + tr (R)
Given the Rodrigues vector rR =[r1 r2 r3
]T, the rotation matrix R is
computed as
R =1
(1 + r21 + r22 + r23 )
r21 − r22 − r23 2(r1r2− r3) 2(r1r3 + r2)
2(r1r2 + r3) −r21 + r22 − r23 2(r2r3− r1)
2(r1r3− r2) 2(r2r3 + r1) −r21 − r22 + r23
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 29 / 32
Cayley-Klein parameters
Cayley-Klein (CK) parameters are elements of 2×2 complex matrices
Q =
(α β
γ δ
)where α,β ,γ,δ are complex variables. Q is be unitary and the CKparameters obey the following constraints:
α = δ ∗
β =−γ∗
Q can also be written as
Q =
(α β
−β ∗ α∗
)with the additional constraint
detQ = αα∗+ ββ
∗ = 1
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 30 / 32
Cayley-Klein parameters
Q contains three free parameters that can be used to describe rotations;given the CK parameters (α,β ,γ,δ ), it is possible to compute the rotationmatrix as follows:
R =
12(α2−β 2− γ2 + δ 2) 1
2 j(−α2−β 2 + γ2 + δ 2) γδ −αβ
12 j(α2−β 2 + γ2−δ 2) 1
2(α2 + β 2 + γ2 + δ 2) −j(αβ + γ + δ )
βδ −αγ j(αγ + βδ ) αδ + βγ
R elements are all real, although they derive from complex numbers.
Given the Euler angles φ ,θ ,ψ, the CK parameters can be computed asfollows:
α = ej(φ+ψ) cos(
θ
2
)β = jej(φ−ψ) cos
(θ
2
)γ = je−j(φ−ψ) cos
(θ
2
)δ = e−j(φ+ψ) cos
(θ
2
)
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 31 / 32
Cayley-Klein parameters
The relation between CK parameters {α,β}, Euler parameters{v1,v2,v3,v4}, and quaternion components {q0,q1,q2,q3}, is the following:
α = q0 + jq3 = v4 + jv3
β = q2 + jq1 = v2 + jv1
Q matrix can also be written as:
Q = q01+ j(q1σ1 +q2σ2 +q3σ3)
where 1 is the identity 2×2 matrix and the σ i are the so-called Pauli spinmatrices.
σ1 =
[0 11 0
]σ2 =
[0 −jj 0
]σ3 =
[1 00 −1
].
B. Bona (DAUIN) Attitude Representation Semester 1, 2015-16 32 / 32