Vectors, Matrices, Rotations Why are we studying this? You want to - - PowerPoint PPT Presentation
Vectors, Matrices, Rotations Why are we studying this? You want to - - PowerPoint PPT Presentation
Vectors, Matrices, Rotations Why are we studying this? 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
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
- f 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=[ 5 2]
(“column” vector)
[ ]
5 2 = p
(“row” vector)
x y z
= 2 5 2 p
p
Representing Position: vectors
p 5 2
The “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
x
b ˆ
y
b ˆ
You can turn an arbitrary vector p into a unit vector of the same direction this way:
y y x x
b a b a b a + = ⋅ ) cos(θ b a =
And what does orthogonal mean?
Unit vectors are orthogonal iff (if and
- nly if) the dot product is zero:
is orthogonal to iff First, define the dot product:
= ⋅b a
when:
= a = b
( )
cos = θ
- r,
- r,
a ˆ b
θ
A couple of other random things
5 2 b
x
b ˆ
y
b ˆ
x y z x y z
right-handed coordinate frame left-handed coordinate frame Vectors are elements of
n
R
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
- bject have different orientations
- We want to represent and difference
- rientations just like we did for
positions…
=
33 32 31 23 22 21 13 12 11
a a a a a a a a a A
=
33 23 13 32 22 12 31 21 11
a a a a a a a a a
T
A
33 32 31 23 22 21 13 12 11
a a a a a a a a a
= 2 5 p
[ ]
2 5 =
T
p
Before we go there – review of matrix transpose
( )
T T T
BA B A =
Important property:
=
22 21 12 11
a a a a A =
22 21 12 11
b b b b B
and matrix multiplication…
+ + + + = =
22 22 12 21 21 22 11 21 22 12 12 11 21 12 11 11 22 21 12 11 22 21 12 11
b a b a b a b a b a b a b a b a b b b b a a a a AB
[ ]
b a b b a a b a b a b a
T y x y x y y x x
= = + = ⋅
Can represent dot product as a matrix multiply:
Same point - different reference frames
x
a ˆ
p 5 2
y
a ˆ
y
b ˆ
x
b ˆ
8 . 3 8 . 3
= 2 5 p
a
= 8 . 3 8 . 3 p
b
a ˆ b ) cos( ) cos( ˆ ˆ θ θ b b a b a l = = ⋅ =
θ
Another important use of the dot product: projection
l
a ˆ b ) cos( ) cos( ˆ ˆ θ θ b b a b a l = = ⋅ =
θ
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
x
a
y
a b ax
ˆ
b a y
ˆ
x
a
p
a
5 2
y
a
8 . 3 8 . 3
b ax
ˆ
b a 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
x
a
p
a
y
a b ax
ˆ
b a y
ˆ
B-frame’s x axis written in A frame
x
A
p 5 2
y
A
8 . 3 8 . 3
B Ax
ˆ
B A y
ˆ
Same point - different reference frames
where:
- r
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
x
a ˆ
y
a ˆ
x
b ˆ
y
b ˆ
θ θ
( )
( ) ( ) ( ) ( )
− = = θ θ θ θ cos sin sin cos ˆ ˆ
b a b a b a
y x R
( ) ( )
= θ θ sin cos ˆb
ax
( ) ( )
− = θ θ cos sin ˆb
a y
( ) ( ) ( ) ( )
− = θ θ θ θ cos sin sin cos
a bR
Example 2: rotation matrix
y
A
z
A
x
A
45
z
B
x
B
y
B
( )
B A B A B A B A
z y x R ˆ ˆ ˆ = − − =
2 1 2 1 2 1 2 1
1
B AR
− − =
2 1 2 1 2 1 2 1
1
B AR
Example 3: rotation matrix
a
x ˆ
a
y ˆ
θ φ
a
z ˆ
b
z ˆ
b
x ˆ
b
y ˆ
− − − = − =
+ + + φ φ φ θ θ φ θ φ θ θ φ θ φ φ φ θ θ φ θ φ θ θ φ θ
π π π
c s s s c c s s c s c c s s c s c c s c c s c c Rc
a
2 2 2
Rotations about x, y, z
( ) ( ) ( ) ( ) ( )
− = 1 cos sin sin cos α α α α α
z
R
( ) ( ) ( ) ( ) ( )
− = β β β β β cos sin 1 sin cos
y
R
( ) ( ) ( ) ( ) ( )
− = γ γ γ γ γ cos sin sin cos 1
x
R
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…
( ) ( ) ( ) ( ) ( )
φ θ φ θ φ θ sin cos cos sin sin ± = ±
( ) ( ) ( ) ( ) ( )
φ θ φ θ φ θ sin sin cos cos cos = ±
Example 1: composition of rotation matrices
C B B A C A
R R R =
p
y
a ˆ
x
b ˆ
y
b ˆ
x
a ˆ
y
c ˆ
x
c ˆ 1
θ
2
θ
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )
− + − − − = − − =
2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 2 2 1 1 1 1
cos sin sin cos cos sin sin cos s s c c s c c s c s s c s s c c Rc
a
θ θ θ θ θ θ θ θ − =
12 12 12 12
c s s c
Example 2: composition of rotation matrices
a
x ˆ
a
y ˆ
θ φ
a
z ˆ
b
x ˆ
c
x ˆ
− = 1
θ θ θ θ
c s s c Rb
a
− = − =
− − − − φ φ φ φ φ φ φ φ
c s s c c s s c Rc
b
1 1
Example 2: composition of rotation matrices
a
x ˆ
a
y ˆ
θ φ
a
z ˆ
b
x ˆ
c
x ˆ
− − − = − − = =
φ φ φ θ θ φ θ φ θ θ φ θ φ φ φ φ θ θ θ θ
c s s s c c s s c s c c c s s c c s s c R R R
c b b a c a