My Head Is Spinning..
My Head Is Spinning..
my head is spinning...
The space of rotations
{
SO( 3) = R ∈ R 3×3
| RR = I , det( R ) = +1
T
}
Special orthogonal group(3):
{
SO( 3) = R ∈ R 3×3
| RR = I , det( R ) = +1
T
}
Special orthogonal group(3):
Why orthogonal:
• vectors in matrix are orthogonal
Why it’s special: det( R ) = +1 , NOT det( R ) = ±1
φ
rzyz = θ
ψ
cos φ − sin φ 0
To get from A to B:
Rz (φ ) = sin φ cos φ 0
0 1
1. Rotate φ about z axis 0
Rzyz ( φ ,θ ,ψ ) = Rz (φ ) R y (θ ) Rz (ψ )
cos φ − sin φ 0 cos θ 0 sin θ cosψ − sinψ 0
Rzyz ( φ ,θ ,ψ ) = sin φ cos φ 0 0 1 0 sinψ cosψ 0
0 0 1 − sin θ 0 cos θ 0 0 1
cφ cθ cψ − sφ sψ − cφ cθ sψ − sφ cψ cφ sθ
Rzyz ( φ ,θ ,ψ ) = sφ cθ cψ + cφ sψ − sφ cθ sψ + cφ cψ sφ sθ
−s c sθ sψ cθ
θ ψ
ZYX Euler Angles (roll, pitch, yaw)
cos φ − sin φ 0
To get from A to B:
Rz (φ ) = sin φ cos φ 0
1. Rotate φ about z axis 0 0 1
2. Then rotate θ about y axis cos θ 0 sin θ
R y (θ ) = 0 1 0
3. Then rotate ψ about x axis − sin θ 0
cos θ
1 0 0
Rx (ψ ) = 0 cosψ − sinψ
0 sinψ cosψ
Rzyx ( φ ,θ ,ψ ) = Rz (φ ) R y (θ ) Rx (ψ )
cos φ − sin φ 0 cos θ 0 sin θ 1 0 0
Rzyz ( φ ,θ ,ψ ) = sin φ cos φ 0 0 1 0 0 cosψ − sinψ
0 0 1 − sin θ 0 cos θ 0 sinψ cosψ
ZYX Euler Angles (roll, pitch, yaw)
Rzyx ( φ , θ ,ψ ) = Rz (φ ) R y (θ ) Rx (ψ )
Problems w/ Euler Angles
If two axes are aligned, then there is a “don’t care” manifold of Euler angles
that represent the same orientation
• The system loses one DOF
0 90
r1 = 90 r2 = 89
0 90
− 90
r1 − r2 = 1 , but the actual distance is 1
− 90
Problem w/ Euler Angles: gimbal lock
kx
Axis: k = ky Angle: θ
k
z
Converting to a rotation matrix:
S ( k )θ
= I + S ( k ) sin (θ ) + S ( k ) (1 − cos(θ ) )
2
Rkθ = e
= [ that equation in the book...]
Rodrigues’ formula
Axis-angle representation
trace( R) − 1
Magnitude of rotation: θ = k = cos −1
2
r32 − r23
1
Axis of rotation: kˆ = r13 − r31
2 sin θ
r − r
21 12
r11 r12 r13
Where:
R = r12 r22 r23
r r23 r33
13
ˆ k
If k ≠0 then k= and θ=k
k
If the three-number version of axis angle is used, then
R0 = I
For most orientations, Rk , is unique.
Still suffers from the “edge” and distance preserving problems of Euler
angles:
0
0
0 r1 − r2 = 0
r1 = 0 r2 = 0 358
179
− 179
, but the actual distance is 2
π 2 0
Calculate the difference between
these two rotations: k1 = 0 k2 = π 2
0 0
π2
This is NOT the right answer: k1 − k 2 = − 2
π
0
cos( π 2 ) 0 sin ( π 2 ) 0 0 1
b
R2 = R y ( 2 ) =
π 0 1 0 = 0 1 0
− sin ( π ) 0 cos( π 2 ) − 1 0 0
2
1 0 0 0 0 1 0 0 1
B T B
1
R2 = R1 R2 = 0 0 1 0 1 0 = − 1 0 0
0 − 1 0 − 1 0 0 0 − 1 0
r32 − r23 − 1 − 1
trace( R ) − 1 −1 1 ˆ 1 1 π
2
θ = cos −1 = cos − = 23 π k= r13 − r31 = 1 k= 3
1
2 2 2 sin θ 3 3
r21 − r12 − 1 − 1
Quaternions
Answer: quaternions…
Quaternions
Q * = ( q0 , q ) = ( q0 , − q )
*
Complex conjugate:
Quaternions
Since: ( )
QQ* = ( q0 , q )( q0 ,−q ) = q0 q0 − q 2 , q0 q − q0 q + q × q = (1,0)
θ ˆ θ
The associated quaternion is: Qkˆ ,θ = cos , k sin
2 2
Therefore, Q represents the same rotation as −Q
Let i
(
P = 0, p
i
) be the quaternion associated with the vector
i
p
*
You can rotate a P from frame a to b: b
P = Qba PQba
a
0 − 1
2
12 − 12 0
= 0, 0 + 0 = 0, 0
− 1 − 1 − 1
2 2
Example: Quaternions
π 2 0
Find the difference between these two axis angle
rotations: k1 = 0 k2 = π 2
0 0
0 12
sin ( π4 ) = cos( π4 ) = 1
Qcb = 1
, 1
2 2
Qba = 1
, 0
2 2
0 0
QP = ( p0 q0 − p ⋅ q, p0 q + q0 p + p × q )
0 − 12
−1
1 1
Qcb = Qca Qba = 2 , 2 2 , 0
1
0 0
θ cb = cos −1 ( 12 ) = 23 π
− 1 − 12
2 − 1
3
= 12 , 12 12 = 12 , 12 kcb = 13
1 1 1
− 2 − 2
− 3
Quaternions: Interpolation
Suppose you’re given two rotations, R1 and R2
How do you calculate intermediate rotations?
Do quaternions help?
Q1 sin (1 − α ) Ω + Q2 sin αΩ
Qi =
sin Ω