vectors, matrices, rotations€¦ · vectors, matrices, rotations. ... 2 5 2 p p. representing...
TRANSCRIPT
Vectors, Matrices, Rotations
You want to put your hand on the cup…
• Suppose your eyes tell you where the mug is and its orientation in the robot base frame (big assumption)
• In order to put your hand on the object, you want to align the coordinate frame of your hand w/ that of the object
• This kind of problem makes representation of pose important...
Why are we studying this?
Why are we studying this?
Puma 500/560
Why are we studying this?
Why are we studying this?
Representing Position: Vectors
Representing Position: vectors
x
y
p
5
2
p=[52 ] (“column” vector)
52p (“row” vector)
x
y
z
2
5
2
p
p
Representing Position: vectors
p
5
2The “a” reference frame
Basis vectors– unit vectors (length of magnitude 1)– orthogonal (perpendicular to each other)
Vector p in written in a reference frame
What is this unit vector you speak of?
Vector length/magnitude:
Definition of unit vector:
These are the elements of p:
5
2
xb ˆ
yb ˆ
You can turn an arbitrary vector p into a unit vector of the same direction this way:
yyxx bababa
)cos(ba
And what does orthogonal mean?
Unit vectors are orthogonal iff (if and only if) the dot product is zero:
is orthogonal to iff
First, define the dot product:
0ba when: 0a
0b
0cos
or,
or, a
b
A couple of other random things
5
2
b xb ˆ
yb ˆ
x
y
zx
y
z
right-handed coordinate frame
left-handed coordinate frame
Vectors are elements of nR
The importance of differencing two vectors
The hand needs to make a Cartesian displacement of this much to reach the object
The importance of differencing two vectors
b
The hand needs to make a Cartesian displacement of this much to reach the object
Representing Orientation: Rotation Matrices
• The reference frame of the hand and the object have different orientations
• We want to represent and difference orientations just like we did for positions…
333231
232221
131211
aaa
aaa
aaa
A
332313
322212
312111
aaa
aaa
aaaTA
333231
232221
131211
aaa
aaa
aaa
2
5p 25Tp
Before we go there – review of matrix transpose
TTT BABA Important property:
2221
1211
aa
aaA
2221
1211
bb
bbB
and matrix multiplication…
2222122121221121
2212121121121111
2221
1211
2221
1211
babababa
babababa
bb
bb
aa
aaAB
bab
baabababa T
y
xyxyyxx
Can represent dot product as a matrix multiply:
Same point - different reference frames
xa ˆ
p
5
2
ya ˆ yb ˆ
xb ˆ
8.3
8.3
2
5pa
8.3
8.3pb
a
b
)cos()cos(ˆˆ bbabal
Another important use of the dot product: projection
l
a
b
)cos()cos(ˆˆ bbabal
Another important use of the dot product: projection
l
Another way of writing the dot product
p
5
2
8.3
8.3
B-frame’s x axis written in A frame
B-frame’s y axis written in A frame
Same point - different reference frames
xa
ya
ba x
ba y
xa
pa
5
2
ya
8.3
8.3
ba x
ba y B-frame’s y axis written
in A frame
Same point - different reference frames
B-frame’s x axis written in A frame
5
2
8.3
8.3
B-frame’s y axis written in A frame
Same point - different reference frames
xa
pa
ya
ba x
ba y
B-frame’s x axis written in A frame
xA
p
5
2
yA
8.3
8.3
BA x
BA y
Same point - different reference frames
where:
or
The rotation matrix
To recap:
where:
The rotation matrix
To recap:
where:
We will write:
so:
Notice the way the notation “cancels out”
But, can we do this: ???
The rotation matrix
Multiply both sides by inverse:
But, can we do this: ???
It turns out that:
because the columns of are unit, orthogonal
The rotation matrix
Multiply both sides by inverse:
But, can we do this: ???
It turns out that:
because the columns of are orthogonal
This is important!
The rotation matrix
So, if:
Then:
The rotation matrix
Both columns are orthogonal
But:
So, the rows are orthogonal too!
The rotation matrix
Both columns are orthogonal
But:
So, the rows are orthogonal too!
The same matrix can be understood both ways!
Example 1: rotation matrix
xa ˆ
ya ˆ
xb ˆ
yb ˆ
cossin
sincosˆˆ b
ab
ab
a yxR
sin
cosˆb
a x
cos
sinˆb
a y
cossin
sincosa
bR
Example 2: rotation matrix
yA
zA
xA
45
zB
xB
yB
BA
BA
BA
BA zyxR ˆˆˆ
21
21
21
21
0
0
1
0
0BAR
21
21
21
21
0
010
0
BAR
Example 3: rotation matrix
ax
ay
az
bzbx
by
cs
ssccs
scscc
ss
csccs
ccscc
Rca
002
2
2
Rotations about x, y, z
100
0cossin
0sincos
zR
cos0sin
010
sin0cos
yR
cossin0
sincos0
001
xR
These rotation matrices encode the basis vectors of the after-rotation reference frame in terms of the before-rotation reference frame
Remember those double-angle formulas…
sincoscossinsin
sinsincoscoscos
Example 1: composition of rotation matrices
CB
BA
CA RRR
p
ya ˆ
xb ˆ
yb ˆ
xa ˆ
yc ˆ
xc ˆ
12
21212121
21212121
22
22
11
11
cossin
sincos
cossin
sincos
ssccsccs
csscssccRc
a
1212
1212
cs
sc
Example 2: composition of rotation matrices
ax
ay
az
bx
cx
100
0
0
cs
sc
Rba
cs
sc
cs
sc
Rcb
0
010
0
0
010
0
Example 2: composition of rotation matrices
ax
ay
az
bx
cx
cs
ssccs
scscc
cs
sc
cs
sc
RRR cb
ba
ca
00
010
0
100
0
0