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 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? Puma 500/560
Why are we studying this?
Why are we studying this?
Representing Position: Vectors
Representing Position: vectors p = [ 2 ] y 5 (“column” vector) p 2 [ ] = p 2 5 (“row” vector) x 5 y 2 p = p 5 x 2 z
Representing Position: vectors The “a” reference frame p 2 5 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? These are the elements of p : b ˆ y Vector length/magnitude: 2 b ˆ x 5 Definition of unit vector: You can turn an arbitrary vector p into a unit vector of the same direction this way:
And what does orthogonal mean? ⋅ = + a b a b a b First, define the dot product: x x y y = cos( θ a b ) b ⋅ b = = a 0 a 0 when: = or, b 0 θ ( ) ˆ a θ = cos 0 or, Unit vectors are orthogonal iff (if and only if) the dot product is zero: is orthogonal to iff
A couple of other random things b ˆ y n R Vectors are elements of 2 b ˆ b x 5 y y z x x z right-handed left-handed coordinate frame coordinate frame
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…
Before we go there – review of matrix transpose a a a a a a 11 12 13 11 21 31 = A a a a T = A a a a 21 22 23 12 22 32 a a a a a a 31 32 33 13 23 33 a a a 11 12 13 a a a 21 22 23 a a a 31 32 33 5 ( ) T T T [ ] = A B BA Important property: = 2 T p = p 5 2
and matrix multiplication… a a b b 11 12 = A 11 12 = B a a b b 21 22 21 22 + + a a b b a b a b a b a b 11 12 11 12 11 11 12 21 11 12 12 22 = = AB + + a a b b a b a b a b a b 21 22 21 22 21 11 22 21 21 12 22 22 Can represent dot product as a matrix multiply: b [ ] x T ⋅ = + = = a b a b a b a a a b x x y y x y b y
Same point - different reference frames a ˆ y b ˆ y 3 . 8 p 2 a ˆ x 5 3 . 8 b ˆ x 5 3 . 8 a = 2 p b = p 3 . 8
Another important use of the dot product: projection b θ ˆ a l = ˆ ⋅ = ˆ θ = θ l a b a b cos( ) b cos( )
Another important use of the dot product: projection b Another way of writing the dot product θ ˆ a l = ˆ ⋅ = ˆ θ = θ l a b a b cos( ) b cos( )
Same point - different reference frames a y a y ˆ B-frame’s y axis written b in A frame 3 . 8 p 2 a x 5 3 . 8 a x ˆ b B-frame’s x axis written in A frame
Same point - different reference frames a y a y ˆ B-frame’s y axis written b in A frame 3 . 8 a p 2 a x θ 5 3 . 8 a x ˆ b B-frame’s x axis written in A frame
Same point - different reference frames a y a y ˆ B-frame’s y axis written b in A frame 3 . 8 a p 2 a x 5 3 . 8 a x ˆ b B-frame’s x axis written in A frame
Same point - different reference frames A y A ˆ where: y B 3 . 8 or p 2 A x 5 3 . 8 A x ˆ B
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 But, can we do this: ??? Multiply both sides by inverse: It turns out that: because the columns of are unit, orthogonal
The rotation matrix But, can we do this: ??? Multiply both sides by inverse: It turns out that: This is important! because the columns of are orthogonal
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 The same matrix can be understood both ways! But: So, the rows are orthogonal too!
Example 1: rotation matrix a ˆ y b ˆ y b ˆ x θ a ˆ θ x ( ) θ cos ( ) ( ) θ − θ cos sin ( ) a x ˆ b = ) ( a a a = ˆ ˆ = R x y θ sin ) ( ) ( b b b θ θ sin cos ( ) ( ) ( ) θ θ cos sin − θ sin a y b R ˆ b = = ) ) ( ( ) ( θ a cos − θ θ sin cos
Example 2: rotation matrix ( ) A A A A = ˆ ˆ ˆ R x y z A y B B B B 0 1 1 2 2 A R = − 0 1 0 B z B − 0 1 1 A x 2 2 45 0 1 1 A z 2 2 B x A R = − 0 1 0 B y B − 0 1 1 2 2
Example 3: rotation matrix ˆ z ˆ x a b ˆ z b ˆ y ˆ y b a φ θ ˆ x a − − − c c s c c c c s c s θ φ θ θ θ φ θ θ φ π φ + 2 a = = − R c s c c s c s c c s s θ φ θ θ θ φ θ θ φ π φ + 2 s 0 s s 0 c φ φ φ π φ + 2
Rotations about x, y, z ( ) ( ) α − α cos sin 0 ( ) ( ) ( ) α = α α R sin cos 0 z 0 0 1 ( ) ( ) β β cos 0 sin ( ) β = R 0 1 0 y ) ( ) ( − β β sin 0 cos 1 0 0 ( ) ( ) ( ) γ = γ − γ R 0 cos sin x ( ) ( ) γ γ 0 sin cos 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 sin cos cos sin ( ) ( ) ( ) ( ) ( ) θ ± φ = θ φ θ φ cos cos cos sin sin
Example 1: composition of rotation matrices a ˆ y b ˆ y c ˆ y θ θ 1 2 p a ˆ x A A B R = R R C B C b ˆ x c ˆ x ( ) ( ) ( ) ( ) θ − θ θ − θ − − − cos sin cos sin c c s s c s s c 1 1 2 2 1 2 1 2 1 2 1 2 a = = R c ( ) ( ) ( ) ( ) θ θ θ θ + − sin cos sin cos s c c s c c s s 1 1 2 2 1 2 1 2 1 2 1 2 − c s 12 12 = s c 12 12
Example 2: composition of rotation matrices ˆ z ˆ x a c ˆ y a φ ˆ x b θ ˆ x a − c s 0 − c 0 s c 0 s θ θ − φ − φ φ φ a = R b s c 0 b = = R c 0 1 0 0 1 0 θ θ 0 0 1 − s 0 c s 0 c − φ − φ φ φ
Example 2: composition of rotation matrices ˆ z ˆ x a c ˆ y a φ ˆ x b θ ˆ x a − − − − c s 0 c 0 s c c s c s θ θ φ φ θ φ θ θ φ a a b = = = − R R R s c 0 0 1 0 s c c s s c b c θ θ θ φ θ θ φ 0 0 1 s 0 c s 0 c φ φ φ φ
Recommend
More recommend