Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as:...

29
Rotations and Translations 1

Transcript of Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as:...

Page 1: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Rotations and Translations

1

Page 2: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Mathematical terms The inner product of 2 vectors a,b is defined as:

The cross product of 2 vectors is defined as:

A unit vector will be marked as:

, , , , ,x y z x y z x x y y z za a a a b b b b a b a b a b a b

X

2

Page 3: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Representing a Point 3D A three-dimensional point

A is a reference coordinate system

here

z

y

xA

p

p

p

P

3

Page 4: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Representing a Point 3D (cont.)

Once a coordinate system is fixed, we can locate any point in the universe with a 3x1 position vector.

The components of P in {A} have numerical values which indicate distances along the axes of {A}.

To describe the orientation of a body we will attach a coordinate system to the body and then give a description of this coordinate system relative to the reference system.

4

Page 5: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Example

0

2

1

PB ?PA

134.05.02866.0)30sin()30cos( 00 YB

XB

XA PPP

232.2YAP

0.866 0.500 0.000 1 0.134

0.500 0.866 0.000 * 2 2.232 ``

0.000 0.000 1.000 0 0.000

AP

000.0ZAP

AX

BX

AYBY

PB

30

5

Page 6: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Description of Orientation

ˆˆˆˆˆˆ

ˆˆ ˆˆ ˆˆ

ˆˆ ˆˆ ˆˆ

ˆˆˆ

ABABAB

ABABAB

ABABAB

BA

BA

BAA

B

ZZZYZX

YZYYYX

XZXYXX

ZYXR

BX

AX

BX

AYBY

is a unit vector in B

is a coordinate of a unit vector of B in coordinates system A (i.e. the projection of onto the unit direction of its reference)

BA X

BX

6

Page 7: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Example Rotating B relative to A around Z by30

000.1000.0000.0

000.0866.0500.0

000.0500.0866.0

RAB

AX

BX

AYBY

7

Page 8: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Example In general:

AX

BX

AYBY

100

0cossin

0sincos

ZAB R

8

Page 9: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Using Rotation Matrices

PRP BAB

A 9

Page 10: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Translation

AX

AY

AZ

BX

BY

BZ

PB

BORGAP

BORGABA PPP

10

Page 11: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Combining Rotation and Translation

BORGABA

BA PPRP

AX

BX

PB

BORGAP

PAAY

BY

11

Page 12: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

What is a Frame ? A set of four vectors giving position and

orientation information. The description of the frame can be

thought as a position vector and a rotation matrix.

Frame is a coordinate system, where in addition to the orientation we give a position vector which locates its origin relative to some other embedding frame.

12

Page 13: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Arrows Convention An Arrow - represents a vector drawn

from one origin to another which shows the position of the origin at the head of the arrow in terms of the frame at the tail of the arrow. The direction of this locating arrow tells us that {B} is known relative to {A} and not vice versa.

13

Page 14: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Rotating a frame B relative to a frame A about Z axis by degrees and moving it 10 units in direction of X and 5 units in the direction of Y. What will be the coordinates of a point in frame A if in frame B the point is : [3, 7, 0]T?

Example

30

000.0

562.12

098.9

000.0

000.5

000.10

0.000

7.562

0.902-

000.0

000.5

000.10

000.0

000.7

000.3

000.1000.0000.0

000.0866.0500.0

000.0500.0866.0

PA

14

Page 15: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Extension to 4x4

110001

PPRP BBORG

AAB

A

We can define a 4x4 matrix operator and use a 4x1 position vector

15

Page 16: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Example

If we use the above example we can see that:

1000

000.0000.1000.0000.0

000.5000.0866.0500.0

000.10000.0500.0866.0

TAB

16

Page 17: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

P in the coordinate system A

1

000.0

562.12

098.9

1

000.0

000.7

000.3

1000

000.0000.1000.0000.0

000.5000.0866.0500.0

000.10000.0500.0866.0

PA

17

Page 18: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Formula

PTP BAB

A

18

Page 19: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Compound Transformation

PTP BAB

A PTP CBC

B

PTTP CBC

AB

A TTT BC

AB

AC

19

Page 20: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Several Combinations

TTT

TTTT

TT

TTTTTT

BC

UB

UC

DC

DA

UA

UC

AU

UA

DC

BC

UB

DA

UA

UD

1

1

11

20

Page 21: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Example Rotating a frame B relative to a frame A about

Z axis by degrees and moving it 1 units in direction of X and 2 units in the direction of Y. What will be

?ABT

30

21

Page 22: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Example cont - 2 We create a homogeneous transformation

using the function se2: T1 = se2(1, 2, 30*pi/180)T1 = 0.8660 -0.5000 1.0000 0.5000 0.8660 2.0000 0 0 1.0000Note that this is a 2D matrix, we eliminate

the z axis

22

Page 23: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Example cont - 3

We can also plot this, relative to the world coordinate frame, by:

>> axis([0 5 0 5]);>>trplot2(T1, 'frame', '1', 'color', 'b')

23

Page 24: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Example cont - 4

We can plot a point by:>> P = [3; 2];>> plot_point(P, ‘*’);

24

Page 25: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Example cont - 5 Now we got something like this: The point P is

known with respectto {0}

We want todetermine the coordination of point P with respect to {1}

25

Page 26: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Example cont - 6

What do we know ?

But…

>> P1 = inv(T1)* [P; 1]

>> P1 = h2e( inv(T1) * e2h(P) );h2e: homogenous to euclidean

0 0 11P T P

1 1 0 0 10 1( )P T P T P

26

Page 27: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Example cont - 7

This also can be achieved by:>> homtrans(inv(T1), P)

27

Page 28: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Example Rotating a frame B relative to a frame A about Z axis by

degrees and moving it 10 units in direction of X and 5 units in the direction of Y. What will be the coordinates of a point in frame A if in frame B the point is : [3, 7, 0]T?

>> T = se2(10,5,30*pi/180) >> P = [3;7;1] >> P2 = T*P >> P = inv(T)*P2

30

28

Page 29: Rotations and Translations 1. Mathematical terms The inner product of 2 vectors a,b is defined as: The cross product of 2 vectors is defined as: A unit.

Notes

Homogeneous transforms are useful in writing compact equations; a computer program would not use them because of the time wasted multiplying ones and zeros. This representation is mainly for our convenience.

For the details turn to chapter 2.

29