four different ways to represent · pdf fileaxis-angle representation theorem: (euler). any...
Post on 09-Mar-2018
217 Views
Preview:
TRANSCRIPT
my head is spinning...
Four different ways to represent rotation
The space of rotations
Special orthogonal group(3):
( ) 1)det(,|3 33 +==∈= × RIRRRRSO T
Rotations preserve distance: 2121 ppRpRp −=−
Rotations preserve orientation: ( ) ( ) ( )2121 ppRRpRp ×=×
Why ? 1)det( ±=R
The space of rotations
Special orthogonal group(3):
( ) 1)det(,|3 33 +==∈= × RIRRRRSO T
Why it’s a group:
• Closed under multiplication: if then
• Has an identity:
• Has a unique inverse…
• Is associative…
( )321 SORR ∈( )3, 21 SORR ∈( ) 11 s.t. 3 RIRSOI =∈∃
Why orthogonal:
• vectors in matrix are orthogonal
Why it’s special: , NOT1)det( +=R 1)det( ±=R
Right hand coordinate system
Possible rotation representations
You need at least three numbers to represent an arbitrary rotation in SO(3) (Euler theorem). Some three-number representations:
• ZYZ Euler angles
• ZYX Euler angles (roll, pitch, yaw)
• Axis angle
One four-number representation:
• quaternions
To get from A to B:
1. Rotate about z axis
2. Then rotate about y axis
3. Then rotate about z axis
ZYZ Euler Angles
=
ψθφ
zyzr
−=
100
0cossin
0sincos
)( φφφφ
φzR
−=
θθ
θθθ
cos0sin
010
sin0cos
)(yR
φθψ
−=
100
0cossin
0sincos
)( ψψψψ
ψzR
( ) )()()(,, ψθφψθφ zyzzyz RRRR =
Therefore, the sequence of rotations is concatentated as follows:
ZYZ Euler Angles
( )
−
−
−=
100
0cossin
0sincos
cos0sin
010
sin0cos
100
0cossin
0sincos
,, ψψψψ
θθ
θθφφφφ
ψθφzyzR
Remember that encode the desired rotation in the pre-rotation reference frame:
)(φzR )(θyR )(ψzR
rotationpostrotationpre
z RR −−=)(φ
( )
−+−+−−−
=
θψθψθ
θφψφψθφψφψθφ
θφψφψθφψφψθφ
ψθφcsscs
ssccscsscccs
sccssccssccc
Rzyz ,,
−=
100
0cossin
0sincos
)( φφφφ
φzR
−=
θθ
θθθ
cos0sin
010
sin0cos
)(yR
−=
ψψψψψ
cossin0
sincos0
001
)(xR
φTo get from A to B:
1. Rotate about z axis
2. Then rotate about y axis
3. Then rotate about x axis
θψ
( ) )()()(,, ψθφψθφ xyzzyx RRRR =
ZYX Euler Angles (roll, pitch, yaw)
( )
−
−
−=
ψψψψ
θθ
θθφφφφ
ψθφcossin0
sincos0
001
cos0sin
010
sin0cos
100
0cossin
0sincos
,,zyzR
In Euler angles, the each rotation is imagined to be represented in the post-rotation coordinate frame of the last rotation
( ) )()()(,, ψθφψθφ xyzzyx RRRR =
ZYX Euler Angles (roll, pitch, yaw)
In Fixed angles, all rotations are imagined to be represented in the original (fixed) coordinate frame.
ZYX Euler angles can be thought of as:
1. ZYX Euler
2. XYZ Fixed
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
0
1r
=
90
89
90
2r
−
−=−
90
1
90
21 rr , but the actual distance is 1
Problem w/ Euler Angles: gimbal lock
1. When a small change in orientation is associated with a large change in rotation representation
2. Happens in “singular configurations” of the rotational representation (similar to singular configurations of a manipulator)
3. This is a problem w/ any Euler angle representation
Problem w/ Euler Angles: gimbal lock
Problem w/ Euler Angles: gimbal lock
Axis-angle representation
Theorem: (Euler). Any orientation, , is equivalent to a rotation about a fixed axis, , through an angle
=
z
y
x
k
k
k
k
( )3SOR∈3R∈ω )2,0[ πθ ∈
θAxis: Angle:
( ) ( ) ( ) ( ) ( )( )θθθθ cos1sin 2 −++== kkkk SSIeR S
(also called exponential coordinates)
[ ]book... in theequation that =
Rodrigues’ formula
Converting to a rotation matrix:
Axis-angle representation
−== −
2
1)(cos 1 Rtrace
kθ
=
332313
232212
131211
rrr
rrr
rrr
R
Magnitude of rotation:
332211)( rrrRtrace ++=
Where:
−−−
=
1221
3113
2332
sin2
1ˆ
rr
rr
rr
kθ
Axis of rotation:
and:
Converting to axis angle:
Axis-angle representation
Axis angle is can be encoded by just three numbers instead of four:
k
kk
=ˆ k=θIf then0≠k and
For most orientations, , is unique.kR
If the three-number version of axis angle is used, then
IR =0
For rotations of , there are two equivalent representations:180
kk RR −=If then180=k
Axis-angle problems
Still suffers from the “edge” and distance preserving problems of Euler angles:
=
179
0
0
1r
−=
179
0
0
2r
=−
358
0
0
21 rr
, but the actual distance is 2
Distance metric changes as you get further from origin.
Projection distortions
Example: differencing rotations
=
0
02
1
π
kCalculate the difference between
these two rotations:
=
0
0
22πk
−=−
02
2
21π
π
kkThis is NOT the right answer:
27.1272
21 ==− πkkAccording to that, this is the
magnitude of the difference:
=
0
02
1
π
k
Convert to rotation matrices to solve this problem:
=
0
0
22πk
−−=
−
−==
010
001
100
001
010
100
010
100
001
2121 RRR BTB
( ) ( ) ( )( ) ( )
−=
−==
010
100
001
cossin0
sincos0
001
22
2221
ππ
πππx
b RR
( )( ) ( )
( ) ( )
−=
−==
001
010
100
cos0sin
010
sin0cos
22
22
22
ππ
ππ
πy
b RR
πθ 3211
2
1cos
2
1)(cos =
−=
−= −− Rtrace
Example: differencing rotations
−
−=
−−−
=1
1
1
3
1
sin2
1ˆ
1221
3113
2332
rr
rr
rr
kθ
−
−=
1
1
1
332 π
k
2121 RRR BTB=
So far, rotation matrices seem to be the most reliable method of manipulating rotations. But there are problems:
• Over a long series of computations, numerical errors can cause these 3x3 matrices to no longer be orthogonal (you need to “orthogonalize” them from time to time).
• Although you can accurately calculate rotation differences, you can’t interpolate over a difference.’
• Suppose you wanted to smoothly rotate from one orientation to another – how would you do it?
Quaternions
Answer: quaternions…
Quaternions
3210 kqjqiqqQ +++=Generalization of complex numbers:
( )qqQ ,0=
( ) ( )qqqqQ −== ,, 0*
0*
Essentially a 4-dimensional quantity
( )( )32103210 kpjpippkqjqiqqQP ++++++=Multiplication:
( )qppqqpqpqpQP ×++⋅−= 0000 ,
Complex conjugate:
1−==== ijkkkjjii
kjiij =−=
ikjjk =−=
jikki =−=
Properties of complex dimensions:
Quaternions
Invented by Hamilton in 1843:
Along the royal canal in Dublin…
Quaternions
123
22
21
20
2 =+++= qqqqQLet’s consider the set of unit
quaternions:
This is a four-dimensional hypersphere, i.e. the 3-sphere 3S
Therefore, the inverse of a unit quaternion is: 1* −=QQ
( ) ( ) ( ) )0,1(,,, 002
0000* =×+−−=−= qqqqqqqqqqqqqQQ
The identity quaternion is: ( )0,1=Q
Since:
You can rotate from frame a to b:
Quaternions
Pa *ba
aba
b PQQP =
Given a unit axis, , and an angle, :
Associate a rotation with a unit quaternion as follows:
k θ (just like axis angle)
=
2sinˆ,
2cos
,ˆ
θθθ kQk
The associated quaternion is:
Therefore, represents the same rotation asQ Q−
Let be the quaternion associated with the vector ( )pP ii ,0= pi
bacbca QQQ =Composition:
1−= bacacb QQQInversion:
Rotate by
Example: Quaternions
=
0
0
,2
12
1Q
=
0
0
1
,0Pa
−
==
0
0
,
0
0
1
,0
0
0
,2
12
12
12
1*PQQP ab
−
=
21
21
21
21 0,0
0
0
,
−=
−
−+
−=
1
0
0
,000,0
21
21
21
21
=
0
02
1
π
kFind the difference between these two axis angle
rotations:
=
0
0
22πk
Example: Quaternions
=
0
0
,2
12
1cbQ
=
0
0,2
1
21
baQ( ) ( )2
144 cossin == ππ
−
== −
0
0,
0
0
,2
1
21
21
211
bacacb QQQ
( )qppqqpqpqpQP ×++⋅−= 0000 ,
−
−=
−
−=
21
21
21
21
21
21
21
21
21 ,,
( ) πθ 32
211cos == −
cb
−
−=
31
31
31
cbk
Quaternions: Interpolation
Suppose you’re given two rotations, and
How do you calculate intermediate rotations?1R 2R
( ) 21 1 RRRi αα −+= This does not even result in a rotation matrix
Do quaternions help?
( )( ) 21
21
1
1
QQQi αα
αα−+−+=
Suprisingly, this actually works
• Finds a geodesic
This method normalizes automatically (SLERP):
( )Ω
Ω+Ω−=sin
sin1sin 21 αα QQQi
top related