Four different ways to represent rotation my head is spinning... - - PowerPoint PPT Presentation

four different ways to represent rotation
SMART_READER_LITE
LIVE PREVIEW

Four different ways to represent rotation my head is spinning... - - PowerPoint PPT Presentation

Four different ways to represent rotation my head is spinning... The space of rotations { } ( ) 3 3 T = = = + SO 3 R R | RR I , det( R ) 1 Special orthogonal group(3): = det( R ) 1 Why


slide-1
SLIDE 1

my head is spinning...

Four different ways to represent rotation

slide-2
SLIDE 2

The space of rotations

Special orthogonal group(3):

( )

{ }

1 ) det( , | 3

3 3

+ = = ∈ =

×

R I RR R R SO

T

Rotations preserve distance:

2 1 2 1

p p Rp Rp − = −

Rotations preserve orientation:

( ) ( ) ( )

2 1 2 1

p p R Rp Rp × = ×

Why ?

1 ) det( ± = R

slide-3
SLIDE 3

The space of rotations

Special orthogonal group(3):

( )

{ }

1 ) det( , | 3

3 3

+ = = ∈ =

×

R I RR R R SO

T

Why it’s a group:

  • Closed under multiplication: if then
  • Has an identity:
  • Has a unique inverse…
  • Is associative…

( )

3

2 1

SO R R ∈

( )

3 ,

2 1

SO R R ∈

( )

1 1

s.t. 3 R IR SO I = ∈ ∃

Why orthogonal:

  • vectors in matrix are orthogonal

Why it’s special: , NOT

1 ) det( + = R 1 ) det( ± = R

Right hand coordinate system

slide-4
SLIDE 4

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
slide-5
SLIDE 5

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

          = ψ θ φ

zyz

r

          − = 1 cos sin sin cos ) ( φ φ φ φ φ

z

R           − = θ θ θ θ θ cos sin 1 sin cos ) (

y

R

φ

θ ψ

          − = 1 cos sin sin cos ) ( ψ ψ ψ ψ ψ

z

R

slide-6
SLIDE 6

( )

) ( ) ( ) ( , , ψ θ φ ψ θ φ

z y z zyz

R R R R =

Therefore, the sequence of rotations is concatentated as follows:

ZYZ Euler Angles

( )

          −           −           − = 1 cos sin sin cos cos sin 1 sin cos 1 cos sin sin cos , , ψ ψ ψ ψ θ θ θ θ φ φ φ φ ψ θ φ

zyz

R

Remember that encode the desired rotation in the pre- rotation reference frame:

) (φ

z

R ) (θ

y

R ) (ψ

z

R

rotation post rotation pre z

R R

− −

= ) (φ ( )

          − + − + − − − =

θ ψ θ ψ θ θ φ ψ φ ψ θ φ ψ φ ψ θ φ θ φ ψ φ ψ θ φ ψ φ ψ θ φ

ψ θ φ c s s c s s s c c s c s s c c c s s c c s s c c s s c c c Rzyz , ,

slide-7
SLIDE 7

          − = 1 cos sin sin cos ) ( φ φ φ φ φ

z

R           − = θ θ θ θ θ cos sin 1 sin cos ) (

y

R           − = ψ ψ ψ ψ ψ cos sin sin cos 1 ) (

x

R

φ

To get from A to B:

  • 1. Rotate about z axis
  • 2. Then rotate about y axis
  • 3. Then rotate about x axis

θ ψ

( )

) ( ) ( ) ( , , ψ θ φ ψ θ φ

x y z zyx

R R R R =

ZYX Euler Angles (roll, pitch, yaw)

( )

          −           −           − = ψ ψ ψ ψ θ θ θ θ φ φ φ φ ψ θ φ cos sin sin cos 1 cos sin 1 sin cos 1 cos sin sin cos , ,

zyz

R

slide-8
SLIDE 8

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

          = 90

1 

r           =

  

90 89 90

2

r           − − = −

  

90 1 90

2 1

r r

, but the actual distance is

1

slide-9
SLIDE 9

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

slide-10
SLIDE 10

Problem w/ Euler Angles: gimbal lock

slide-11
SLIDE 11

Problem w/ Euler Angles: gimbal lock

slide-12
SLIDE 12

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

( )

3 SO R∈

3

R ∈ ω ) 2 , [ π θ ∈

θ

Axis: Angle:

( )

( ) ( ) ( ) ( ) ( )

θ θ

θ θ

cos 1 sin

2

− + + = = k k

k k

S S I e R

S

(also called exponential coordinates)

[ ]

book... in the equation that =

Rodrigues’ formula Converting to a rotation matrix:

slide-13
SLIDE 13

Axis-angle representation

      − = =

2 1 ) ( cos 1 R trace k θ           =

33 23 13 23 22 12 13 12 11

r r r r r r r r r R

Magnitude of rotation:

33 22 11

) ( r r r R trace + + =

Where:

          − − − =

12 21 31 13 23 32

sin 2 1 ˆ r r r r r r k θ

Axis of rotation: and: Converting to axis angle:

slide-14
SLIDE 14

Axis-angle problems

Still suffers from the “edge” and distance preserving problems of Euler angles:

          =

179

1

r           − =

179

2

r           = −

358

2 1

r r

, but the actual distance is

2

Distance metric changes as you get further from origin.

slide-15
SLIDE 15

Axis-angle representation

Axis angle is can be encoded by just three numbers instead of four:

k = θ

If then

≠ k

and For most orientations, , is unique.

k

R

If the three-number version of axis angle is used, then

I R =

For rotations of , there are two equivalent representations:

180

k k

R R

=

If then

180 = k

slide-16
SLIDE 16

Projection distortions

slide-17
SLIDE 17

Example: differencing rotations

          =

2 1 π

k

Calculate the difference between these two rotations:

          =

2 2 π

k

          − = −

2 2 2 1 π π

k k

This is NOT the right answer:

27 . 127 2

2 1

= = − π k k

According to that, this is the magnitude of the difference:

slide-18
SLIDE 18

          =

2 1 π

k

Convert to rotation matrices to solve this problem:

          =

2 2 π

k

          − − =           −           − = = 1 1 1 1 1 1 1 1 1

2 1 2 1

R R R

B T B

( ) ( ) ( ) ( ) ( )

          − =           − = = 1 1 1 cos sin sin cos 1

2 2 2 2 2 1 π π π π π x b

R R

( ) ( ) ( ) ( ) ( )

          − =           − = = 1 1 1 cos sin 1 sin cos

2 2 2 2 2 2 π π π π π y b

R R

π θ

3 2 1 1

2 1 cos 2 1 ) ( cos =      − =       − =

− −

R trace

Example: differencing rotations

          − − =           − − − = 1 1 1 3 1 sin 2 1 ˆ

12 21 31 13 23 32

r r r r r r k θ           − − = 1 1 1 3

3 2 π

k

2 1 2 1

R R R

B T B

=

slide-19
SLIDE 19

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…

slide-20
SLIDE 20

Quaternions

3 2 1

kq jq iq q Q + + + =

Generalization of complex numbers:

( )

q q Q , =

( ) ( )

q q q q Q − = = , ,

* *

Essentially a 4-dimensional quantity

( )( )

3 2 1 3 2 1

kp jp ip p kq jq iq q QP + + + + + + =

Multiplication:

( )

q p p q q p q p q p QP × + + ⋅ − = ,

Complex conjugate:

1 − = = = = ijk kk jj ii k ji ij = − = i kj jk = − = j ik ki = − =

Properties of complex dimensions:

slide-21
SLIDE 21

Quaternions

Invented by Hamilton in 1843: Along the royal canal in Dublin…

slide-22
SLIDE 22

Quaternions

1

2 3 2 2 2 1 2 2

= + + + = q q q q Q

Let’s consider the set of unit quaternions: This is a four-dimensional hypersphere, i.e. the 3-sphere

3

S

Therefore, the inverse of a unit quaternion is:

1 * −

= Q Q

( )( )

( )

) , 1 ( , , ,

2 *

= × + − − = − = q q q q q q q q q q q q q QQ

The identity quaternion is:

( )

, 1 = Q

Since:

slide-23
SLIDE 23

You can rotate from frame a to b:

Quaternions

P

a * ba a ba b

PQ Q P =

Given a unit axis, , and an angle, : Associate a rotation with a unit quaternion as follows:

k ˆ θ

(just like axis angle)

                    = 2 sin ˆ , 2 cos

, ˆ

θ θ

θ

k Qk

The associated quaternion is: Therefore, represents the same rotation as

Q Q −

Let be the quaternion associated with the vector

( )

p P

i i

, = p

i ba cb ca

Q Q Q =

Composition:

1 −

=

ba ca cb

Q Q Q

Inversion:

slide-24
SLIDE 24

Rotate by

Example: Quaternions

                    = ,

2 1 2 1

Q

                    = 1 , P

a

                    −                                         = = , 1 , ,

2 1 2 1 2 1 2 1 *

PQ Q P

a b

                        −                     =

2 1 2 1 2 1 2 1

, ,                     − =                     − − +           − = 1 , ,

2 1 2 1 2 1 2 1

slide-25
SLIDE 25

          =

2 1 π

k

Find the difference between these two axis angle rotations:           =

2 2 π

k

Example: Quaternions

                    = ,

2 1 2 1 cb

Q                     = ,

2 1 2 1 ba

Q

( ) ( )

2 1 4 4

cos sin = =

π π

                   −                     = =

, ,

2 1 2 1 2 1 2 1 1 ba ca cb

Q Q Q ( )

q p p q q p q p q p QP × + + ⋅ − = ,

                    − − =                         − − =

2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1

, , ( )

π θ

3 2 2 1 1

cos = =

− cb

            − − =

3 1 3 1 3 1 cb

k

slide-26
SLIDE 26

Quaternions: Interpolation

Suppose you’re given two rotations, and How do you calculate intermediate rotations?

1

R

2

R

( )

2 1

1 R R Ri α α − + =

This does not even result in a rotation matrix Do quaternions help?

( ) ( )

2 1 2 1

1 1 Q Q Q Q Qi α α α α − + − + =

Suprisingly, this actually works

  • Finds a geodesic

This method normalizes automatically (SLERP):

( )

Ω Ω + Ω − = sin sin 1 sin

2 1

α α Q Q Qi

slide-27
SLIDE 27

Supplementary

slide-28
SLIDE 28

In Euler angles, the each rotation is imagined to be represented in the post-rotation coordinate frame of the last rotation

( )

) ( ) ( ) ( , , ψ θ φ ψ θ φ

x y z zyx

R R R R =

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