Advances in Robotics Lecture 5.
Advances in Robotics Lecture 5.
By Dr.A Chandrashekhar
Department of Mechatronics
Position analysis-Coordinate
transformation from one frame
to another in 2D
Overview
• Why transformations?
• Basic transformations:
– translation, rotation, scaling
• Combining transformations
– homogenous coordinates, transform. Matrices
instantiation…
world
train animation…
viewing…
wheel
modelling…
image
Why transformation?
• For the purpose of controlling a robot, it is
necessary to know the relationships between the
joints motion (input) and the end-effector
motions (output), because the joint motions
control the end-effector movements.
Pt ( x t , y t , z t )
X
– computational factors (eg digital round off, steady-state control errors); and
• Workspace:
– Reachable WS: set of positions the EE can reach
– Dexterous WS: set of positions the EE can reach with a given
orientation
Prismatic Joint
1 DOF (linear) (Variables - d)
An Example - The PUMA 560
2
3
4
1 There are two more
joints on the end
effector (the gripper)
1 Joint 3
Joint 1
yt
z1 Link 1
zw
World (Base) Coordinate Frame
xw
yt
Link frame zt Tool Coordinate
Frame
zw
World (Base) Coordinate
xw Frame
We are interested in two
kinematics topics
Forward Kinematics (angles to position)
What you are given: The length of each link
The angle of each joint
A •B = A B cosθ A bx
b
θ y
Matrix Representation: B
a x b x
A•B = • b = a xb x + a yb y
a y y
Unit Vector
Vector in the direction of a chosen vector but whose magnitude
is 1. B
uB =
B B
uB
Quick Matrix Review
Matrix Multiplication:
An (m x n) matrix A and an (n x p) matrix B, can be multiplied
since the number of columns of A is equal to the number of rows of B.
Non-Commutative Multiplication
AB is NOT equal to BA
Matrix Addition:
a b e f (a + e) (b + f )
c + =
d g h (c + g ) (d + h)
Coordinate system
• Global coordinate system - corresponds to the
entire body and is used to define nodes in the
entire body.
• Local coordinate system - corresponds to a
particular element in the body , and the
numbering is done to that particular element
neglecting the entire body .
• WORLD-coordinate system is a
Cartesian coordinate system for describing the
location of the points within the workspace.
Tracking the Robot
• One of the gotchas of robotics is keeping track of which frame of
reference is being used. The global coordinate frame is relative to the
robot’s surrounding. We start robotics experiments with the robot at
position (0, 0) and facing in the direction of the axis
• The local coordinate frame is relative to the robot. We use the local
coordinates when measuring the movement or setting the velocity of the
wheels.
The Robot’s Global Position
• We call the robot’s location and orientation in the
global coordinate frame the position, or pose, of the
robot. The robot’s position is represented as a matrix
(P) containing its x and y Cartesian coordinate pair
and its angle of orientation (Ɵ).
Transformations in 2-D
• For robots that move in two dimensions, such as a
mobile robot or arm type robots that move in a plane,
the robot’s pose is a three element vector:
• An alternative expression of the pose is to define it as a
coordinate frame. The coordinate frame consists of two
perpendicular (orthogonal) axis and an (x, y) point
location of the origin of the coordinate frame. The
coordinate frame pose is usually expressed by a matrix.
This allows us to express the coordinate frame of
connected parts and joints of the robot with respect
other coordinate frames. Then by matrix multiplication
and linear algebra, we can easily determine a coordinate
frame with respect to the world frame, or any other
frame of interest.
Basic Transformations
Moving Between Coordinate Frames
(VN,VO)
VO
P
N
X VN
Px
V X
V N
Px
V =
XY
V =
NO
P=
Y O
Notation:
V V 0
Writing VXY in terms oVf NO
Y O
VO
P θ
N
X VN
PX + V N
V XY
= O = P +V NO
V
O
Translation along the X-Axis and Y-Axis
VO
N
VN
Px
X P XY
=
PY
P + V N
V = P +V =
XY NO X
O
Y
P + V
Using Basis Vectors
Basis vectors are unit vectors that point along a coordinate
axis
O
V N
VNO cosθ V NO
cosθ V NO
• n
V =
NO
= NO = NO = NO
V
O V sinθ V cos(90 − θ) V • o
Y
Rotation (around the Z-Axis)
Z X
Y
VY
θ
X
VX
V X
V N
V =
XY
V =
NO
Y O
V V
Y X Unit vector along X-Axis
V Can be considered with respect t
the XY coordinates or NO coordinate
V
V X Y
= V N O
VY
θ
X
VX
V X = V X Y cosα = V N O cosα = V N O • x
= (V n + V o) • x
X N O (Substituting for VNO using the N and O
V components of the vector)
V X = V N (x • n) + V O (x • o)
= V N (cosθ) + V O (cos(θ + 90))
= V N (cosθ) − V O (sinθ)
Similarly….
V Y = V N O sinα = V N O cos(90 − α) = V N O • y
V Y = (VN n + V O o) • y
V Y = V N (y • n ) + V O (y • o )
= V N (cos(90 − θ)) + V O (cosθ)
= V N (sinθ) + V O (cosθ)
So….
V = V (cosθ) − V (sinθ)
X N O VX
V XY = Y
V Y = V N (sinθ) + V O (cosθ) V
Written in Matrix Form
V X
cosθ − sinθ V N
Rotation Matrix about the z-
V =
XY
= O axis
V
Y sinθ cosθ V
Y1
(VN,VO)
Y0
VNO
VXY
X1
P
Translation along P followed by rotation by
X0
V X P x cosθ − sinθ V N
V XY
= = +
Y
cosθ V O
V P y sinθ
(Note : Px, Py are relative to the original coordinate frame. Translation followed
by rotation is different than rotation followed by translation.)
cosθ − sinθ Px
H = sinθ cosθ Py Homogenous Matrix for a Translation in
XY plane, followed by a Rotation
0 0 1 around the z-axis
Rotation Matrices in 3D – OK,lets return from
cosθ −si nθ 0 homogenous repn
Rotation around the Z-
R z = sinθ cosθ 0 Axis
0 0 1
cosθ 0 sinθ
Ry = 0 1 0 Rotation around the Y-
Axis
−sinθ 0 cosθ
1 0 0
R z = 0 cosθ − sinθ Rotation around the X-
Axis
0 sinθ cosθ
Homogeneous Matrices in 3D
H is a 4x4 matrix that can describe a translation, rotation, or both in one
matrix O
1 0 0 Px
0 1 0 Py
Y
N H=
P 0 0 1 Pz
X A 0 1
Translation without 0 0
Z rotation
Y
nx ox ax 0
n oy ay 0
H= y
O
N
n z oz az 0
X 0 0 0 1
Rotation part:
Z Rotation without Could be rotation around z-
A axis, x-axis, y-axis or a
translation
combination of the three.
Homogeneous Continued….
VN
O The (n,o,a) position of a point relative to the
V
V =H
XY current coordinate frame you are in.
VA
1
nx ox ax Px V N
n oy ay Py V O VX = n VN + o VO + a VA + P
V XY = y x x x x
nz oz az Pz V A
0 0 0 1 1
Y WN
WO
WA
T
P
X
Z
WX WI WN
Y Point relative to the WJ Point relative to the WO Point relative to the
W X-Y-Z frame I-J-K frame N-O-A frame
WZ WK WA
WI ni oi ai Pi W N
W Pi n i
I
oi aiW N
J n
J O Pj W O
W = Pj + n j oj aj W W = j oj aj
W K Pk n k W K nk Pk W A
ok a k W A
ok ak
1 0 0 0 1 1
W N
Y WO
WA
T
P
X
Z
WX ix jx kx Tx W I
W Tx i x
X
kx W I
W Y i Ty W J
jx
Y J = y jy ky
W = Ty + i y jy k y W
W Z i z jz kz Tz W
K
W Z Tz i z jz k z W k
1 0 0 0 1 1
W X i x jx k x Tx n i jy k y oi ai Pi W N
WI Y
WJ i Ty n j jz k z oj aj Pj W O
Substituting W = y
for WK W Z i0z 0 0 Tz n k ok ak Pk W A
1 1 0 0 0 1 1
W
X
WN
O
i x jx kx Tx n i oi ai Pi
Y n Pj
W = HW i jy ky Ty oj aj
H = y
j
WZ WA i z jz kz Tz n k ok ak Pk
1 1 0 0 0 1 0 0 0 1
Product of the two
matrices
Notice that H can also be written as:
1 0 0 Tx i x jx kx 01 0 0 Pi n i oi ai 0
0 0 0 0
1 0 Ty i y jy ky 1 0 Pj n j oj aj
H =
0 0 1 Tz i z jz kz 00 0 1 Pk n k ok ak 0
0 1
0 0 1 0 0 0 1 0 0 0 1 0 0 0
T
P
X
Z
One more variation on finding H:
This method might seem a bit confusing, but it’s actually an easier
way to solve our problem given the information we have.
Coordinate management
Kinematics of Robot Arms
Kinematics of Robot Arms
• The study of moving bodies and parts is
called Kinematics. In robotics, we use kinematics
to facilitate the discussion of the pose and also
velocity of robots, parts of robots (sensors, arms,
joints, and end effectors), and objects of interest.
• When we know the joint angles and link lengths
of a robot arm, we use forward kinematics to
calculate the pose of parts of the arm. When we
know what pose is needed, we use inverse
kinematics to calculate the joint angles that will
yield the desired pose.
Forward and Inverse
Kinematics Joint 2
2
1 Joint 3
Joint 1
yt
z1 Link 1
zw
World (Base) Coordinate Frame
xw
yt
Link frame zt Tool Coordinate
Frame
zw
World (Base) Coordinate
xw Frame
We are interested in two
kinematics topics
Forward Kinematics (angles to position)
What you are given: The length of each link
The angle of each joint
The Quest:
What is the position of the
end of the robotic arm?
Solution:
1. Geometric Approach
This might be the easiest solution for the simple situation. However,
notice that the angles are measured relative to the direction of the previous link.
(The first link is the exception. The angle is measured relative to it’s initial
position.) For robots with more links and whose arm extends into 3 dimensions
the geometry gets much more tedious.
2. Algebraic Approach
Involves coordinate transformations.
Example Problem:
You are have a three link arm that starts out aligned in the x- axis.
Each link has lengths l1, l2, l3, respectively. You tell the first one to move by 1
, and so on as the diagram suggests. Find the Homogeneous matrix to get
the position of the yellow dot in the X0Y0 frame.
Y3
3
Y2 2 X3 3
2 X2
Y2 2 X3 3
2 X2
X4
Y0 This takes you from the X0Y0 frame to the X4Y4 frame.
1
The position of the yellow dot relative to the X4Y4 frame is (0,0).
1
X0
X 0
Y 0
= H
Z 0 Notice that multiplying by the (0,0,0,1) vector
1 will equal the last column of the H matrix.
1
More on Forward Kinematics…
Denavit - Hartenberg
Parameters
Denavit-Hartenberg
Notation
Z(i - 1)
Y(i -1) Yi Zi
Xi ai
a(i - 1 ) di
X(i -1)
i
( i - 1)
1) a(i-1)
Technical Definition: a(i-1) is the length of the perpendicular between the
joint axes. The joint axes is the axes around which revolution takes place
which are the Z(i-1) and Z(i) axes. These two axes can be viewed as lines
in space. The common perpendicular is the shortest line between the two
axis-lines and is perpendicular to both axis-lines.
a(i-1) cont...
Visual Approach - “A way to visualize the link parameter a(i-1) is to imagine
an expanding cylinder whose axis is the Z(i-1) axis - when the cylinder just
touches the joint axis i the radius of the cylinder is equal to a(i-1).” (Manipulator
Kinematics)
Z(i - 1)
Y(i -1) Yi Zi
Xi ai
a(i - 1 ) di
X(i -1)
i
( i - 1)
2) (i-1)
Technical Definition: Amount of rotation around the common perpendicular so that
the joint axes are parallel.
i.e. How much you have to rotate around the X(i-1) axis so that the Z(i-1) is pointing in
the same direction as the Zi axis. Positive rotation follows the right hand rule.
3) d(i-1)
Technical Definition: The displacement
along the Zi axis needed to align the a(i-1) Z(i - 1)
common perpendicular to the ai common
Y(i -1) Yi Zi
perpendicular.
In other words, displacement along the Xi ai
Zi to align the X(i-1) and Xi axes. a(i - 1 ) di
X(i -1)
If the link is prismatic, then d(i-1) i
is a variable, not a parameter ( i -
1)
4) i or i
Amount of rotation around the Zi axis needed to align the X(i-1) axis with the Xi axis.
The Denavit-Hartenberg Matrix
cosθi − sinθi 0 a(i−1)
sinθ cosα cosθ cosα − sinα − sinα d
i (i −1) i (i−1) (i−1) (i −1) i
Z0 Z1
X2
d2
X0 X1
Denavit-Hartenberg Link
Y0 Y1
Parameter Table
a0 a1 i (i-1) a(i-1) di i
Z0 Z1
0 0 0 0 0
X2
d2 1 0 a0 0 1
X0 X1
Y0 Y1 2 -90 a1 d2 2
a0 a1
T =( T)(0 T)(1T)
V X2
0 1 2
Y2
V
V X 0 Y0 Z 0 =T
V Z2 Note: T is the D-H matrix with (i-1) = 0 and i = 1.
1
i (i-1) a(i-1) di i
cosθ0 −sinθ0 0 0
0 0 0 0 0 sinθ cosθ0 0 0
T = 0
1 0 a0 0 1
0
0 0 1 0
0 0 0 1
2 -90 a1 d2 2
This is just a rotation around the Z0
axis
0 0 0 0 − sinθ 2 − cosθ 2 0 0
0
0 0 0 1 0 0 1
• What we want:
– Joint coordinates qnx1 (variable under robot motion).
A mapping f from EE position and orientation to joint coordinates:
q1
... = f (x, y,z, , , )
x y z
• Problematic, because: qn
– EE position may be out of reachable workspace (no solution)
– EE position and orientation may be out of dexterous workspace (no solution)
– EE position may be reachable in several ways (multiple solutions, redundancy)
– EE position may be reachable in infinitely many ways (infinite number of solutions,
redundancy)
– f is highly nonlinear, no closed form solution for complicated configurations.
Inverse Kinematics
• How we get there:
S Finding S:
1
X S = (x 2 + y 2 )
Inverse Kinematics of a Two Link Manipulator
(x , y) l
Given: 1, l2 , x , y
Find: 1, 2
2
l2 Redundancy:
(x , y)
The Geometric Solution
l2 Using the Law of Cosines:
2
(x , y)
c 2 = a 2 + b 2 − 2ab cos C
(x 2 + y 2 ) = l 2 + l 2 − 2l l cos(180 − θ )
1 2 1 2 2
cos(180 − θ 2 ) = −cos(θ2 )
l1 x12 + y 2 − l 22 − l 2
cos(θ2 ) =
2l1l2
1 x 21 + y 2 − l 22 − l 2
θ 2 = arccos
2l1l2
Using the Law of Cosines:
Redundant since 2 could be in
sin B sin C
= the first or fourth quadrant.
b c
sinθ1 sin(180 −θ 2 ) sin(θ2 ) Redundancy caused since 2 has two
= =
l2 x 2 + y2 x 2 + y2 possible values
θ1 = θ1 +α l sin(θ ) y
y θ1= arcsin 2 2
+ arctan 2
α = arctan2 x 2 + y2 x
x
(x , y)
l2
2
The Algebraic Solution
c 1 = co sθ 1
l1 c1+2 = co s (θ 2 + θ1 )
(1) x = l 1 c 1 + l 2 c 1 + 2
1
(2) y = l 1 s 1 + l 2 sin 1+ 2
(3) θ = θ 1 + θ 2
(1)2 + (2)2 = x 2 + y 2 =
( 2 2
)( 2 2
)
= l1 c1 + l2 2 (c 1+2 ) 2 + 2l1l 2 c1 (c 1+2 ) + l1 s1 + l2 2 (sin 1+2 ) 2 + 2l1l2 s1 (sin1+2 )
= l1 2 + l2 + 2l1 l2 (c(c
1 1+2 ) + s1 (sin 1+2 ))
2
= l1 2 + l2 + 2l1l 2 c 2
2
Only Unknown Note:
x21 + y 2 − l22 − l 2 cos(a+b) = (cos a)(cosb)− (sin a)(sinb)
− +
θ 2 = arccos
+ +
2l1l2 sin(a b) = (cos a)(sinb) (cosb)(sin a)
− −
x = l1 c 1 + l 2 c 1 + 2 Note:
= l1 c 1 + l 2 c 1 c 2 − l 2 s 1 s 2 cos(a+b) = (cosa)(cosb)− (sin a)(sinb)
− +
= c 1 (l 1 + l 2 c 2 ) − s 1 (l 2 s 2 )
sin(a+b) = (cosa)(sinb)+ (cosb)(sin a)
− −
y = l 1 s 1 + l 2 sin 1 + 2
We know what 2 is from the previous
= l1 s1 + l 2 s 1 c 2 + l 2 s 2 c1
slide. We need to solve for 1 . Now
= c 1 (l 2 s 2 ) + s 1 (l 1 + l 2 c 2 ) we have two equations and two
unknowns (sin 1 and cos 1 )
x + s 1 (l 2 s 2 )
c1 = Substituting for c1 and
(l 1 + l 2 c 2 ) simplifying many times
x + s 1 (l 2 s 2 )
y= (l 2 s 2 ) + s 1 (l 1 + l 2 c 2 )
(l 1 + l 2 c 2 )
Notice this is the law of cosines
=
1
(l 1 + l 2 c 2 )
(
xl 2 s 2 + s1 (l1 2 + l 2 2 + 2l1l 2 c 2 ) ) and can be replaced by x2+ y2
y ( l + l 2 c 2 ) − x l2 s y(l 1 + l 2 c 2 ) − x l 2 s 2
s1 = 1 2 θ 1 = arcsin
x 2 + y2
x 2 + y2
cosθ −si nθ 0
Rotation around the Z-
R z = sinθ cosθ 0 Axis
0 0 1