Basic Kinematics •Spatial Descriptions and Transformations •Introduction to Motion
Mar 19, 2016
Basic Kinematics
•Spatial Descriptions and Transformations•Introduction to Motion
Objectives of the Lecture
• Learn to represent position and orientation• Be able to transform between coordinate
systems.• Use frames and homogeneous coordinates
Reference: Craig, “Introduction to Robotics,” Chapter 2.Reference: Craig, “Introduction to Robotics,” Chapter 2.
Handout: Chapter 1Handout: Chapter 1
Almost any introductory book to roboticsAlmost any introductory book to robotics
Introduction
• Robot manipulation implies movement in space
• Coordinate systems are required for describing position/movement
• Objective: describe rigid body motion• Starting point: there is a universe/ inertial/
stationary coordinate system, to which any other coordinate system can be referred
The Descartes Connection • Descartes invented what we now call Cartesian
coordinates, or the system by which we can graph mathematical functions in two-or three-dimensional space.
• So, all of those problems you have been working in algebra are his fault.
• Descartes was lying on his bed watching a fly. Slowly, it came to him that he could describe the fly's position at any instant by just three numbers. Those three numbers were along the planes of the floor and two adjacent walls, what we now call the x,y,z coordinate system.
• So, all of those problems you have been working in algebra are really the fly’s fault (kill that fly)
Coordinate System in Robotics
D
e
s
c
a
r
t
e
s
i
n
v
e
n
t
e
d
w
h
a
t
w
e
n
o
w
c
a
l
l
C
a
r
t
e
s
i
a
n
c
o
o
r
d
i
n
a
t
e
s
,
o
r
t
h
e
s
y
s
t
e
m
b
y
w
h
i
c
h
w
e
c
a
n
g
r
a
p
h
m
a
t
h
e
m
a
t
i
c
a
l
f
u
n
c
t
i
o
n
s
i
n
t
w
o
-
o
r
t
h
r
e
e
-
d
i
m
e
n
s
i
o
n
a
l
s
p
a
c
e
.
S
o
,
a
l
l
o
f
t
h
o
s
e
p
r
o
b
l
e
m
s
y
o
u
h
a
v
e
b
e
e
n
w
o
r
k
i
n
g
i
n
a
l
g
e
b
r
a
a
r
e
h
i
s
f
a
u
l
t
.
D
e
s
c
a
r
t
e
s
w
a
s
l
y
i
n
g
o
n
h
i
s
b
e
d
w
a
t
c
h
i
n
g
a
f
l
y
.
S
l
o
w
l
y
,
i
t
c
a
m
e
t
o
h
i
m
t
h
a
t
h
e
c
o
u
l
d
d
e
s
c
r
i
b
e
t
h
e
f
l
y
'
s
p
o
s
i
t
i
o
n
a
t
a
n
y
i
n
s
t
a
n
t
b
y
j
u
s
t
t
h
r
e
e
n
u
m
b
e
r
s
.
T
h
o
s
e
t
h
r
e
e
n
u
m
b
e
r
s
w
e
r
e
a
l
o
n
g
t
h
e
p
l
a
n
e
s
o
f
t
h
e
f
l
o
o
r
a
n
d
t
w
o
a
d
j
a
c
e
n
t
w
a
l
l
s
,
w
h
a
t
w
e
n
o
w
c
a
l
l
t
h
e
x
,
y
,
z
c
o
o
r
d
i
n
a
t
e
s
y
s
t
e
m
.
S
o
,
a
l
l
o
f
t
h
o
s
e
p
r
o
b
l
e
m
s
y
o
u
h
a
v
e
b
e
e
n
w
o
r
k
i
n
g
i
n
a
l
g
e
b
r
a
a
r
e
r
e
a
l
l
y
t
h
e
f
l
y
’
s
f
a
u
l
t
(
k
i
l
l
t
h
a
t
f
l
y
)
Three Problems with CS
• Given 2 CS’s, how do we express one as a function of the other?
• Given a point in one CS, what are the point’s coordinates on a second CS?
• Apply an operation on a vector
Description of a Position
• point = position vector
YA
XA
ZA
{A}
AP
z
y
xA
ppp
P
a coordinate system
Description of an Orientation
• In the example, a description of {B} with respect to {A} suffices to give orientation
• Orientation = System of Coordinates
• Directions of {B}: XB, YB and ZB
• In {A} coord. system: AXB, AYB and AZB
x0
x1
z0
y0
z1
y1
{A}
{B}
Often a point is not enough: need orientation
From {A} to {B}{A}
XB
aXaY
aZ BAX XX cos BAY XY cos
BAZ XZ cos
We conclude:
BA
BA
BA
BA
XZXYXX
X
Rotation Matrix• Stack three unit vectors to form Rotation Matrix• describes {B} with respect to {A}
• Each vector in can be written as dot product of pair of unit vectors: cosine matrixcosine matrix
• Rows of : unit vectors of {A} with respect to {B}
• What is ? What is det( )?• Position + orientation = Frame
RAB
BA
BA
BAA
B ZYXR ˆˆˆRA
B
RAB
1RAB RA
B
Description of a Frame• Frame: set of four
vectors giving position + orientation
• Description of a frame: position + rotation matrix
• Ex.:
x0
x1
z0
y0
z1
y1
{A}
{B}
BORGAA
B PRB ,}{
• position: frame with identity as rotation
• orientation: frame with zero position
Mapping: from frame 2 frame
• If {A} has same orientation as {B}, then {B} differs from {A} in a translation: APBORG
AP = BP + APBORG
• Mapping: change of description from one frame to another. The vector APBORG defines the mapping.
XA
ZA
YA
{A}ZB
YB
{B}
XB
AP
APBORG
BP
Translated Frames
Rotated Frames
YA
XA
ZA
X B
Z B
YB
BPBzByBx
B ZpYpXpP
BA
zBA
yBA
xA ZpYpXpP
z
y
x
BA
BA
BAA
ppp
ZYXP
PRP BAB
A
Description of Rotation = Rotation Matrix
Rotated Frame (cont.)• The previous expression can be written as
• The rotation mapping changes the description of a point from one coordinate system to another
• The point does not change! only its description
PRP BAB
A
Example (2D rotation)
XA
YA
Y B
X B
x0
y0
x 1
y 1
cossinsincos
001
001
yxyyxx
General Frame Mapping
{A}
XB
YB
ZB
BP
XA
YA
ZA
AP
APBORG
BORGABA
BA PPRP
Replace by the more appealing equation:
110001PPRP B
BORGAA
BA
A “1” added here A row added here
Homogeneous Coords• Homogeneous coordinates: embed 3D
vectors into 4D by adding a “1”• More generally, the transformation matrix T
has the form:
FactorScalingTrans. Perspect.Vector Trans. MatrixRot.
T
Operators: Translation, Rotation and General Transformation
• Translation Operator:
1
12
|)|,ˆ( PQQTRANS
QPPAA
AAA
1P
2PQ
Translation Operator
• Translation Operator: • Only one coordinate frame, point moves• Equivalent to mapping point to a 2nd frame• Point Forward = Frame Backwards
• How does TRANS look in homogeneous coordinates?
• Rotational OperatorOperators (cont.)
AP1
AP2
K
Rotation around axis:
Rotation Operator
• Rotational OperatorThe rotation matrix can be seen as rotational
operator• Takes AP1 and rotates it to AP2=R AP1
• AP2=ROT(K, q)(AP2) • Write ROT for a rotation around K
Operators (Cont.)• Transformation Operators* A transformation mapping can be viewed as
a transformation operator: map a point to any other in the same frame
* Transform that rotates by R and translates by Q is the same a transforming the frame by R & Q
Compound TransformationIf {C} is known relative to {B}, and {B} is
known relative to {A}. We want to transform P from {C} to {A}:
Write down the compound in homog. coords
TTT
PTP
PTP
PTP
BC
AB
AC
BAB
A
CAC
A
CBC
B
define here From
Inverse Transform
Write down the inverse transform in HC’s
More on Rotations• We saw that a rotation can be represented by
a rotation matrix• Matrix has 9 variables and 6+ constraints
(which?)• Rotations are far from intuitive: they do not
commute!• Rotation matrix can be parameterized in
different manners:—Roll, pitch and yaw angles—Euler Angles—Others
Euler’s Theorem
• Euler’s Theorem: Any two independent orthonormal coordinate frames can be related by a sequence of rotations (not more than three) about coordinate axes, where no two successive rotations may be about the same axis.
• Not to be confused with Euler angles, Euler integration, Newton-Euler dynamics, inviscid Euler equations, Euler characteristic…
• Leonard Euler (1707-1783)
XYZ Fixed
Euler Angles• This means that we can represent an orientation with 3
numbers• A sequence of rotations around principle axes is called an
Euler Angle Sequence• Assuming we limit ourselves to 3 rotations without
successive rotations about the same axis, we could use any of the following 12 sequences:
XYZ XZY XYX XZXYXZ YZX YXY YZYZXY ZYX ZXZ ZYZ
Euler Angles
• This gives us 12 redundant ways to store an orientation using Euler angles
• Different industries use different conventions for handling Euler angles (or no conventions)
ZYX Euler
Euler Angles to Matrix Conversion
• To build a matrix from a set of Euler angles, we just multiply a sequence of rotation matrices together:
yxzxzyxzxzyx
yxzxzyxzxzyx
yzyzy
cccssscsscsccsccssssccssssccc
10000
0010
0
00
001
zz
zz
yy
yy
xx
xxzyx cssc
cs
sc
csscRRR
Euler Angle Order
• As matrix multiplication is not commutative, the order of operations is important
• Rotations are assumed to be relative to fixed world axes, rather than local to the object
• One can think of them as being local to the object if the sequence order is reversed
Using Euler Angles
• To use Euler angles, one must choose which of the 12 representations they want
• There may be some practical differences between them and the best sequence may depend on what exactly you are trying to accomplish
x
y
z
u'
v'
v "
w"
w'=
=u"
v'"
u'"
w'"=
Euler Angle I, Animated
Orientation Representation• Euler Angle I
1000cossin0sincos
,cossin0sincos0001
,1000cossin0sincos
''
'
w
uz
R
RR
Euler Angle I
cossincossinsin
sincoscoscoscos
sinsincossincos
cossin
sinsincoscossin
sincoscossinsin
coscos''' wuz RRRR
Resultant eulerian rotation matrix:
Euler Angle II, Animated
x
y
z
u'
v'
=v"
w"
w'=
u"
v"'
u"'
w"'=
Note the opposite (clockwise) sense of the third rotation, .
Orientation Representation• Matrix with Euler Angle II
cossinsinsincos
sinsincoscossin
coscoscoscossin
sincos
sincoscoscossin
cossincoscoscos
sinsin
Quiz: How to get this matrix ?
Orientation Representation• Description of Roll Pitch Yaw
X
Y
Z
Quiz: How to get rotation matrix ?
Vehicle Orientation
• Generally, for vehicles, it is most convenient to rotate in roll (z), pitch (x), and then yaw (y)
• In situations where thereis a definite ground plane,Euler angles can actuallybe an intuitiverepresentation x
y
z
front of vehicle
Euler Angles - Summary
• Euler angles are used in a lot of applications, but they tend to require some rather arbitrary decisions
• They also do not interpolate in a consistent way (but this isn’t always bad)
• There is no simple way to concatenate rotations• Conversion to/from a matrix requires several
trigonometry operations• They are compact (requiring only 3 numbers)
Quaternions
Quaternions
• Quaternions are an interesting mathematical concept with a deep relationship with the foundations of algebra and number theory
• Invented by W.R.Hamilton in 1843• In practice, they are most useful to us as a means
of representing orientations• A quaternion has 4 components
3210 qqqqq
Quaternions (Imaginary Space)
• Quaternions are actually an extension to complex numbers• Of the 4 components, one is a ‘real’ scalar number, and the
other 3 form a vector in imaginary ijk space!
3210 kqjqiqq q
jiijkikkijkjjki
ijkkji
1222
Quaternions (Scalar/Vector)
• Sometimes, they are written as the combination of a scalar value s and a vector value v
where
321
0
qqqqs
v
vq ,s
Unit Quaternions• For convenience, we will use only unit length quaternions,
as they will be sufficient for our purposes and make things a little easier
• These correspond to the set of vectors that form the ‘surface’ of a 4D hypersphere of radius 1
• The ‘surface’ is actually a 3D volume in 4D space, but it can sometimes be visualized as an extension to the concept of a 2D surface on a 3D sphere
123
22
21
20 qqqqq
Quaternions as Rotations
• A quaternion can represent a rotation by an angle θ around a unit axis a:
• If a is unit length, then q will be also2
sin,2
cos
2sin
2sin
2sin
2cos
aq
q
or
aaa zyx
Quaternions as Rotations
112
sin2
cos2
sin2
cos
2sin
2cos
2sin
2sin
2sin
2cos
22222
22222
2222222
23
22
21
20
a
q
zyx
zyx
aaa
aaa
qqqq