Spatial descriptions and
transformations
Sami Haddadin
Robotics and Mechatronics Center
German Aerospace Center (DLR), Germany
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Transform equation
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Transform equation
Two ways to express {D} as products of transformations:
U U
TD = TA A TD (1)
U U B C
TD = TB TC TD (2)
We may set these to descriptions of U TD equal to form a
transform equation
U
TA A TD = U TB B TC C TD (3)
This can be used to solve for transforms in the case of n unknown
transforms and n transform equations.
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Cayley’s formula
so far: rotation only by means of 3 × 3 matrix
all columns are mutually orthogonal and have unit magnitude
we will see: proper RMs have det = 1
we call them proper orthonormal matrices
nonpoper ones have det = −1
General question:
Can we describe orientation with fewer than nine numbers?
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Cayley’s formula
Result from linear algebra: for any orthonormal matrix R, there
exists a skew symmetric matrix, S, such that
R = (I3 − S)−1 (I3 + S) (4)
Now a skew symmetric matrix (i.e. S = −S T ) of dimension 3 is
specified by three paramters (sx , sy , sz ) as
⎡ ⎤
0 −sz sy
S = ⎣ sz 0 −sx ⎦ (5)
−sy sx 0
→ any 3 × 3 rotation matrix can be specified by three parameters.
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Cayley’s formula
Clearly, the nine elements of a rotation matrix are not all
independent. Six dependencies between the elements are easily
obtained:
R = X̂ Ŷ Ẑ (6)
Six constraints:
|X̂ | = 1
|Ŷ | = 1
|Ẑ | = 1
X̂ · Ŷ = 0 (7)
X̂ · Ẑ = 0
Ŷ · Ẑ = 0
Please note that rotations do not generally commute. That is that
AR B R is not the same as B RC A RB .
B C
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Roll-pitch-yaw
One method of describing the orientation of a frame {B} is as
follows:
Start with the frame coincident with a known reference frame
{A}. First rotate {B} about X̂A by an angle γ, then rotate
about ŶA by an angle β, and then rotate about ẐA by an
angle α.
Each rotation takes place about an axis in the fixed reference
fame, {A}. This convention is called X-Y-Z fixed angles or roll,
pitch, yaw.
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Roll-pitch-yaw
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Roll-pitch-yaw
The derivation of the equivalent rotation matrix A RB (γ, β, α) is
straight forward because all rotations occur about axes of the
reference frame.
A
RB (γ, β, α) = RZ (α)RY (β)RX (γ) =
⎡ ⎤⎡ ⎤⎡ ⎤
cα −sα 0 cβ 0 sβ 1 0 0
⎣ sα cα 0 ⎦ ⎣ 0 1 0 ⎦ ⎣ 0 cγ −sγ ⎦ (8)
0 0 1 −sβ 0 cβ 0 sγ cγ
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Roll-pitch-yaw
Thinking in terms of rotations as operators:
⎡ ⎤
cαcβ cαsβsγ − sαcγ cαsβcγ + sαsγ
A
RB (γ, β, α) = ⎣ sαcβ sαsβsγ + cαcγ sαsβcγ − cαsγ ⎦ (9)
−sβ cβsγ cβcγ
Keep in mind that the definition given here specifies the order of
the three rotations.
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Inverse problem
Extracting equivalent X − Y − Z fixed angles from a rotation
matrix is often of interest. The solution depends on solving a set
of transcendental equations: there are nine equations and three
unknowns. Among the nine equations are six dependencies, so
essentially we have three equations and three unknowns.
⎡ ⎤
r11 r12 r13
A
RB (γ, β, α) = ⎣ r21 r22 r23 ⎦ (10)
r31 r32 r33
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Inverse problem
β = arctan 2(−r31 , r11
2 + r2 )
21
α = arctan 2(r21 /cβ, r11 /cβ) (11)
γ = arctan 2(r32 /cβ, r33 /cβ),
where arctan 2(y , x) is a two argument arc tangent function (uses
both signs of x and y ).
convention: use this solution for β for which −90o ≤ β ≤ 90o
if β = ±90o (so that cβ = 0), the solution of (??) degrades
in those cases, only the sum or the difference of α and γ may
be computed
possible convention: α = 0o
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Inverse problem
If β = 90o , then the solution may be calculated as
β = 90o
α = 00 (12)
γ = arctan 2(r12 , r22 ).
If β = −90o , then the solution may be calculated as
β = −90o
α = 00 (13)
γ = − arctan 2(r12 , r22 ).
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Z-Y-X Euler angles
Another method of describing the orientation of a frame {B} is as
follows:
Start with the frame coincident with a known reference frame
{A}. First rotate {B} about ẐB by an angle α, then rotate
about ŶB by an angle β, and then rotate about X̂B by an
angle γ.
Each rotation takes place about an axis in the moving reference
fame, {B}. Such a set of rotations is called Euler angles. Note
that each rotation takes place about an axis whose location
depends upon the preceding rotations. This particular set of
rotations is called Z-Y-X Euler angles.
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Z-Y-X Euler angles
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Z-Y-X Euler angles
Using intermediate frames {B } and {B } we may immediately
write
A
RB = A RB B RB B RB (14)
The final result will be exactly the same as for Roll-Pitch-Yaw. In
total there are 24 angle set conventions. Of these, 12
conventions are for fixed angle sets, and 12 for Euler angle sets.
Because of the duality of fixed and Euler angle sets, there are
really only 12 unique parameterizations of a rotation matrix using
successive rotations about principal axes.
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Angle-axis
RX (30) is an example of an equivalent angle-axis representation.
If the axis is a general direction (rather than one of the unit
directions) any orientation may be obtained through proper axis
and angle selection. Consider the following description of frame
{B}:
Start with the frame coincident with a known frame {A}:
Then rotate {B} about the vector A K̂ by an angle θ
We will write A RB (K̂ , θ) or RK (θ).
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Angle-axis
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Angle-axis
If the axis of rotation is a general axis, it can be shown that the
equivalent rotation matrix is
⎡ ⎤
kx2 v θ + cθ kx ky v θ − kz sθ kx kz v θ + ky sθ
RK (θ) = ⎣ kx ky v θ + kz sθ ky2 v θ + cθ ky kz v θ − kx sθ ⎦ ,
kx kz v θ − ky sθ ky kz v θ + kx sθ kz2 v θ + cθ
(15)
where v θ = 1 − cos θ, and A K̂ = [kx ky kz ]T . The signs of θ is
determined by the right-hand rule with the thumb pointing along
the positive sense of A K̂ .
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Angle-axis: inverse problem
r11 + r22 + r33 − 1
θ = arccos (16)
2
⎡ ⎤
r32 − r23
1 ⎣
K̂ = r13 − r31 ⎦ (17)
2 sin θ
r21 − r12
0o ≤ θ ≤ 180o and for any angle axis pair, there exists another
pair with negative signs.
for small angular rotations, the axis becomes ill-defined.
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Euler parameters
In terms of the equivalent axis K̂ = [kx ky kz ]T and the equivalent
angle θ, the Euler parameters are given by
θ
1 = kx sin (18)
2
θ
2 = ky sin (19)
2
θ
3 = kz sin (20)
2
θ
4 = cos (21)
2
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Euler parameters
It is then clear that these four quantities are not independent, but
that
21 + 22 + 23 + 24 = 1 (22)
must always hold. Hence, an orientation might be visualized as a
point on a unit hypersphere in four-dimensional space. Euler
parameters are also known as a unit quaternion.
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Euler parameters
The rotation matrix, R , which is equivalent to a set of Euler
parameters is given as
⎡ ⎤
1 − 222 − 223 2(1 2 − 3 4 ) 2(1 3 + 2 4 )
R = ⎣ 2(1 2 + 3 4 ) 1 − 221 − 223 2(2 3 − 1 4 ) ⎦ . (23)
2(1 3 − 2 4 ) 2(2 3 + 1 4 ) 1 − 221 − 222
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik
Euler parameters
In terms of the equivalent axis K̂ = [kx ky kz ]T and the equivalent
angle θ, the Euler parameters are given by
r32 − r23
1 =
44
r13 − r31
2 =
44
r21 − r12
3 = (24)
44
1√
4 = 1 + r11 + r22 + r33
2
Note that (??) is not useful in a computational sense if the
rotation matrix represents a rotation of 180o about some axis,
since 4 goes to zero. However, it can be shown that in the limit
all the expressions in (??) remain finite even for this case.
Haddadin, Robotics: http://www6.in.tum.de/Main/TeachingWs2012Robotik