Topic3 Forward Kinematics
Topic3 Forward Kinematics
- Topic 3 -
Forward Kinematics of Robot
Manipulators
Prof. Oscar E. Ramos, Ph.D.
- Week 3 -
Objectives
2
Outline
1. Introduction
2. Geometric method
4. Examples of Denavit-Hartenberg
{n}
qi+1
4
Kinematics of Robot Manipulators
x f (q)
Forward
Joint kinematics Operational
space space
q (q1 , , qn ) x ( x, y , z , , , )
Inverse
kinematics
q f 1 (x)
- Forward kinematics
Given a joint configuration, find the pose (position/orientation) of some part of
the robot (e.g. end effector)
- Inverse Kinematics
Find the joint configuration that achieves a certain pose (position/orientation)
of some part of the robot
5
Kinematics of Robot Manipulators
T=?
q1
Joint vector: q x f (q)
q2
9
Forward Kinematics
• In a generic way: Joint configuration
x f (q)
1 {2}
{1}
T2
{n 1}
0
T1 n 1
Tn
{0}
Base Efector
final {n}
11
Forward Kinematics
Frame for the End Effector
• (almost) By convention:
o
[y] n {e}: end effector frame
[x]
a [z]
- a: approach vector (aligned with the roll axis and pointing outwards)
- o: orientation vector (in the direction of motion of the gripper jaws)
- n: normal vector (orthogonal to the plane defined by o and a)
• Homogeneous transformation matrix:
nx ox ax px
n oy ay p y (px, py, pz): position of {e}
Pose of the end effector with
respect to the robot base
0
Te y with respect to the base
nz oz az pz
0 0 0 1
12
Forward Kinematics
Methods
• In general:
- Assign reference frames to links (not necessarily to every link)
- Relate frame {i} to frame {i-1}
- Apply compositions of transformations to obtain the end effector frame with
respect to the base
13
Forward Kinematics
Methods
• Geometric Methods
- They assign arbitrary reference frames (by inspection)
- The transformation matrices (or screws) from frame to frame are different
(there is no general transformation matrix)
- Examples:
• Generic geometric methods
• Product of exponentials (PoE)
• Systematic Methods:
- They assign reference frames based on rules
- The relation between frames is given by some parameters (based on rules)
- Generic (similar) transformations are obtained between frames
- Examples:
• Denavit-Hartenberg (DH)
• Hayati-Roberts
• Khalil-Kleinfinger, etc.
14
Outline
1. Introduction
2. Geometric method
4. Examples of Denavit-Hartenberg
• Main Characteristic:
- It arbitrarily assigns reference frames
• Procedure:
1. Assign arbitrary frames to each link (they must move with the link) → The
motion is usually about the z axis or along it
2. Describe each frame with respect to the previous one (using homogeneous
transformation matrices)
3. Multiply the partial descriptions (of the kinematic chain) to obtain the end
effector with respect to the base frame
• Note:
- At the end a “standard” frame can be added to the end effector
- Steps 1 and 2 can be done link by link (first for link 1, then for link 2,…)
16
Forward Kinematics: Geometric Method
2D Example: R-R Robot
ŷ y {e} x
y Procedure:
l2 1. Assign frames (that move with each
link)
{1} q2 2. Relate a frame to the previous
l1
one (0T1 and 1Te)
{0} q1
x x̂
ŷ y {e} x
y Procedure:
l2 1. Assign frames (that move with each
link)
{1} q2 2. Relate a frame to the previous
l1
one (0T1 and 1Te)
{0} q1
x x̂
Procedure:
3. Multipliy to obtain the final transformation matrix 0Te
0
Te 0 T1 1Te
cos(q1 ) sin(q1 ) 0 l1 cos(q1 ) cos(q2 ) sin(q2 ) 0 l2 cos(q2 )
sin(q ) cos(q ) 0 l1 sin(q1 ) sin(q2 ) cos(q2 ) 0 l2 sin(q2 )
0
Te 1 1
0 0 1 0 0 0 1 0
0 0 0 1 0 0 0 1
cos( q1 q2 ) sin(q1 q2 ) 0 l1 cos( q1 ) l2 cos(q1 q2 )
sin(q q ) cos(q q ) 0 l1 sin(q1 ) l2 sin(q1 q2 )
0
Te 1 2 1 2
0 0 1 0
0 0 0 1
https://youtu.be/IRDJnwFDq88 https://youtu.be/97KX-j8Onu0
20
Forward Kinematics: Geometric Method
3D Example: SCARA Robot
21
Forward Kinematics: Geometric Method
3D Example: SCARA Robot
1. Take {0} to {1}
q1 l3
- Translate {0} a distance l1 along z0. l2
- Rotate 180°+q1 about z0 to get to {1}
z1
y1 x1
0
T1 Trz (l1 ) Rot z (180 q1 )
l4
1 0 0 0 c1 s1 0 0
0 l1
1 0 0 s c1 0 0
1 z0
0 0 1 l1 0 0 1 0
0 0 0 1 0 0 0 1
y0
x0
c1 s1 0 0
s c1 0 0
0
T1 1
0 0 1 l1
Arbitrarily assign
0 0 0 1 frames
1
T2 Trx (l2 ) Rot z (90 q2 )
l4
1 0 0 l2 s2 c2 0 0
l1
0 z0
1 0 0 c s2 0 0
2
0 0 1 0 0 0 1 0
y0
0 0 0 1 0 0 0 1 x0
s2 c2 0 l2
c s2 0 0
1
T2 2 Arbitrarily assign
0 0 1 0
frames
0 0 0 1
1 0 0 l3 z1 z3 y3
y1 x1 x2
0 1 0 0
2
T3 Trx (l3 ) x3
0 0 1 0
0 0 0 1
z4 x4 l4
y4
4. Take {3} to {4} l1
z0
- Translate {3} a distance (-l4+q3) along z3
- Then, rotate (90°+q4) about z to get to {4} y0
x0
s4 c4 0 0
c Arbitrarily assign
3 s4 0 0
T4 Trz (l4 q3 ) Rot z (90 q4 ) 4 frames
0 0 1 q3 l4
0 0 0 1
24
Forward Kinematics: Geometric Method
3D Example: SCARA Robot
5. Multiply: take {0} to {4} q2 q3
q1 l3 q4
Write the end effector {4} in terms of the l2 z2
base {0} → multiply the kinematic chain y2
z1 z3 y3
0
T4 T1 T2 T3 T4
0 1 2 3
y1 x1 x2
x3
c1 s1 0 0 s2 c2 0 l2 1 0 0 l3 s4 c4 0 0
s c1 0 0 c2 0 0 0 1 0 0 c4 0 z4 x4
0
T4 1
s2 s4 0 l4
0 0 1 l1 0 0 1 0 0 0 1 0 0 0 1 q3 l4 y4
l1
0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 z0
25
Forward Kinematics: Geometric Method
3D Example: SCARA Robot
Optional: q2 q3
q1 l3 q4
The end effector convention can be used (axis n l2 z2 y2
= x, o = y, a = z) for frame {e}
z1 z3 y3
- Rotate {4} 180° about x4 y1 x1 x2
1 0 0 0 1 0 0 0 x3
0 cos(180) sin(180) 0 0 1 0 0
4
Te z4
0 sin(180) cos(180) 0 0 0 1 0 x4 l4
y4
0 0 0 1 0 0 0 1 l1
z0
- Forward kinematics:
y0 xe
x0
0
Te T4 Te
0 4
ye
ze
c124 s124 0 l3 s12 l2 c1
s c124 0 l3c12 l2 s1
0
Te 124
0 0 1 l1 l4 q3
Verify the result when the joint
0 0 0 1 configuration is null (zeros)
26
Forward Kinematics: Geometric Method
3D Example: SCARA Robot
Homogeneous Transformation Matrices using Python
Import sympy
from sympy.matrices import Matrix
matrices
def trotx(ang):
T = Matrix([[1,0,0,0],
Function for [0,cos(ang),-sin(ang),0],
rotation about X [0,sin(ang),cos(ang),0],
[0,0,0,1]])
return T
def trotz(ang):
T = Matrix([[cos(ang),-sin(ang),0,0],
Function for [sin(ang), cos(ang),0,0],
rotation about Z [0,0,1,0],
[0,0,0,1]])
return T
27
Forward Kinematics: Geometric Method
3D Example: SCARA Robot
Homogeneous Transformation Matrices using Python
Homogeneous T1 = transl(0,0,l1)*trotz(pi+q1)
transformations T2 = transl(l2,0,0)*trotz(-pi/2+q2)
and their products T3 = transl(l3,0,0)
T4 = transl(0,0,-l4+q3)*trotz(pi/2+q4)
T04 = simplify(T1*T2*T3*T4)
print(T04)
28
Outline
1. Introduction
2. Geometric method
4. Examples of Denavit-Hartenberg
x0 y0
30
Denavit-Hartenberg Convention
Introduction
• Procedure
1. Determine 1 frame per joint (based on some rules)
2. Determine 4 parameters (θi, di, ai, αi) that describe the pose between every two
reference frames (based on rules)
3. Using the 4 parameters (per joint) compute the homogeneous transformation
matrices
→ Determine the pose of the end effector with respect to the base (product of the
homogeneous transformation matrices)
*J.J. Craig. Introduction to Robotics: Mechanics and Control. 1st edition (1986) 31
Denavit-Hartenberg Convention
(1) Assigning a Reference Frame
• Number joint axes: 1 to n (from the base to the end effector) showing the axis of
motion for each joint
• Base reference frame: assign frame {0} to the base, with axis z0 along the axis
of motion of joint 1 (arbitrary origin)
• Origin of frame {i}: find the origin of frame {i} at the intersection of zi & zi-1, or
at the intersection of zi with the common normal between zi & zi-1
• Axis xi: assign xi in the direction of zi-1 x zi. If they are parallel, assign xi along the
common normal between zi-1 & zi
• Axis yi: assign yi to complete the frame (following the right hand rule)
• End effector frame {n}: xn must be orthogonal to zn-1 and it must intersect it
32
Denavit-Hartenberg Convention
(1) Assigning a Reference Frame
• Number joint axes: 1 to n (from the base to the end effector) showing the axis of
motion for each joint
Joint 2 Joint
Joint
(q2) i+1 (qi+1)
n (qn)
Joint 1
(q1)
Joint
Link 0 i (qi) End
(base) effector
33
Denavit-Hartenberg Convention
(1) Assigning a Reference Frame
• Number joint axes: 1 to n (from the base to the end effector) showing the axis of
motion for each joint
• Base reference frame: assign frame {0} to the base, with axis z0 along the axis
of motion of joint 1 (arbitrary origin)
→ Axis x0 is arbitrary, and axis y0 completes the frame (right-hand rule)
q3
z0 q2
q1 y0
x0
34
Denavit-Hartenberg Convention
(1) Assigning a Reference Frame
q3
z0 q2 z2
q1 y0 z1
x0
35
Denavit-Hartenberg Convention
(1) Assigning a Reference Frame
• Axis xi: assign xi in the direction of zi-1 x zi. If (zi-1 & zi) are parallel, assign xi
along the common normal between zi-1 & zi
• Axis yi: assign yi to complete the frame (following the right hand rule)
q3
z0 q2
q1 y0 y2
z1 y1
z2
x0 x1 x2
q3 z3
z0 q2 x3
q1 y0 y2
z1 y1
z2 y3
x0 x1 x2 n=3
37
Denavit-Hartenberg Convention
(2) Assigning the DH Parameters
Joint Parameters
• Joint angle (θi): rotation angle from axis xi-1 to axis xi about axis zi-1
→ It is the joint variable if the i-th joint is revolute
• Joint displacement (di): distance from the origin of frame {i-1} to the
intersection of axis zi-1 to axis xi along axis zi-1
→ It is the joint variable if the i-th joint is prismatic
• Link length (ai): distance from the intersection of axis zi-1 and axis xi to the origin
of frame {i} along axis xi
• Link rotation angle (αi): rotation angle from axis zi-1 to axis zi about axis xi
38
Denavit-Hartenberg Convention
(2) Assigning the DH Parameters
joint joint
qi-1 qi joint
qi+1
zi
zi-1
xi-1 xi
Joint parameters
• di: distance from the origin of {i-1} to the [intersection of zi-1 with xi] along zi-1
• θi: rotation angle from xi-1 to xi about zi-1
joint joint
qi-1 qi joint
qi+1
Angle between
joint axis
zi
zi-1
xi-1 xi
Link parameters
• ai: distance from [the intersection of zi-1 with xi] to the origin of {i} along xi
• αi: angle from zi-1 to zi about xi
joint joint
qi-1 qi joint
qi+1
zi
zi-1
xi-1 xi
Summary
• di: distance from the origin of {i-1} to the [intersection of zi-1 with xi] along zi-1
• θi: rotation angle from xi-1 to xi about zi-1
• ai: distance from [the intersection of zi-1 with xi] to the origin of {i} along xi
• αi: angle from zi-1 to zi about xi
41
Denavit-Hartenberg Convention
(2) Assigning the DH Parameters
Example
q3 z3
z0 q2 x3
q1 y0 y2
z1 y1
z2 y3
x0 x1 x2
l1 l2
Joint i di θi ai αi
1 0 q1 l1 0
2 0 180+q2 -l2 90
3 l3 180+q3 0 0
di: distance from the origin of {i-1} to [the intersection of zi-1 to xi] along zi-1
θi: rotation angle from xi-1 to xi about zi-1
ai: distance from [the intersection of zi-1 with xi] to the origin of {i} along xi
αi: angle from zi-1 to zi about xi|
42
Denavit-Hartenberg Convention
(2) Assigning the DH Parameters
Example
q3 z3
z0 q2 x3
q1 y0 y2
z1 y1
z2 y3
x0 x1 x2
l1 l2
Note:
Joint i di θi ai αi Joint i di θi ai αi Home
1 0 q1 l1 0 Sometimes 1 0 q1 l1 0 0
2 0 180+q2 -l2 90 written as 2 0 q2 -l2 90 180
3 l3 180+q3 0 0 3 l3 q3 0 0 180
1 0 0 ai
0 cos sin i 0 Always
G
Ti ( i , ai ) Trxi (ai ) Rot xi ( i ) i
constant
0 sin i cos i 0
0 0 0 1
Nota: if first there is a translation, and then a rotation, the result is the same 45
Denavit-Hartenberg Convention
(3) Homogeneous Transformation
cos i sin i 0 0 1 0 0 ai
sin cos i 0 0 0 cos i sin i 0
i 1
Ti (i , di , i , ai ) i
0 0 1 di 0 sin i cos i 0
0 0 0 1 0 0 0 1
0 sin i cos i di
0 0 0 1
Final result:
- End effector with respect to the base
- Using the product of homogeneous transformations
0
Tn 0 T1 1T2 n 2 Tn 1 n 1Tn
47
Denavit-Hartenberg Convention
(3) Homogeneous Transformation
z3
Example q3
x3
z0 q2 y2
q1 y0 z1 y1
Artic. i di θi ai αi z2 y3
1 0 q1 l1 0 x0 x1 x2
l1 l2
2 0 180+q2 -l2 90
3 l3 180+q3 0 0
0 0 1 0
0 0 0 1
cos 180 q2 0 sin 180 q2 l2 cos 180 q2 cos q2 0 sin q2 l2 cos q2
sin 180 q2 0 cos 180 q2 l2 sin 180 q2 sin q2 0 cos q2 l2 sin q2
1
T2
0 1 0 0 0 1 0 0
0 0 0 1 0 0 0 1
48
Denavit-Hartenberg Convention
(3) Homogeneous Transformation
z3
Example q3
x3
z0 q2 y2
q1 y0 z1 y1
Artic. i di θi ai αi z2 y3
1 0 q1 l1 0 x0 x1 x2
l1 l2
2 0 180+q2 -l2 90
3 l3 180+q3 0 0
49
Denavit-Hartenberg Convention
(3) Homogeneous Transformation
z3
Example q3
x3
z0 q2 y2
q1 y0 z1 y1
Artic. i di θi ai αi z2 y3
1 0 q1 l1 0 x0 x1 x2
l1 l2
2 0 180+q2 -l2 90
3 l3 180+q3 0 0
1 0 0 l1 1 0 0 l2 1 0 0 0 1 0 0 l2 l1
0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 l3
0
T1 1
T2 2
T3 0
T3
0 0 1 0 0 1 0 0 0 0 1 l3 0 1 0 0
0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
50
Denavit-Hartenberg Convention
Illustration
Note: the video uses r instead of a and no sub indices are added
https://youtu.be/rA9tm0gTln8
51
Denavit-Hartenberg Convention
(Modified DH*)
ci si 0 ai 1
i 1 c s ci1 ci si1 di si1
Modified: Ti i1 i Frames at the
s s si1 ci ci1 di ci1 beginning of the
i1 i
0 0 0 1 link
1. Introduction
2. Geometric method
4. Examples of Denavit-Hartenberg
1. Reference frames
q3
q2
q1 q4
l2 l3
y0
x0
54
Example 1: DH of a SCARA Robot
1. Reference frames
q3
q2
q1 q4
l2 l3
z1 x1 • Axis zi: zi along the axis of joint i+1
y1
z2 y2 • Origin of frame {i}:
a) Intersection of zi & zi-1, or
x2 b) Intersection of zi with normal between zi & zi-1
(If zi & zi-1 parallel: arbitrary normal)
z3 l4
y3
l1 • Axis xi: in the direction of zi-1 x zi. If (zi-1 &
z0 zi) are parallel, xi along their common
x3
normal
y0
x0 • Axis yi: assign yi to complete the frame
(using the right hand rule)
55
Example 1: DH of a SCARA Robot
1. Reference frames
q3
q2
q1 q4
l2 l3
z1 x1
y1
• End effector frame {n}:
z2 y2 - xn orthogonal to zn-1, intersecting it (origin at
the end of the chain)
x2
- zn in the direction of zn-1 pointing outwards
- yn completes the frame
z3 l4
y3
l1
z0 x3
y0 x4
x0
y4
z4
56
Example 1: DH of a SCARA Robot
2. DH parameters
q3
q2
q1 q4
l2 l3 Joint i di θi ai αi
z1 x1 1 l1 180+q1 l2 0
y1
z2 2 0 -90+q2 l3 0
y2
3 -l4+q3 0 0 0
x2 4 0 90+q4 0 180
z3 l4
y3
l1
z0 x3 di: distance from {i-1} to [intersection of zi-1
with xi] along zi-1
y0 x4 θi: angle from xi-1 to xi alrededor de zi-1
x0
y4 ai: distance from [intersection of zi-1 wtih xi] to
z4 {i} along xi
αi: angle from zi-1 to zi about xi
57
Example 1: DH of a SCARA Robot
Joint i di θi ai αi
1 l1 180+q1 l2 0
2 0 -90+q2 l3 0
3 -l4+q3 0 0 0
4 0 90+q4 0 180
58
Example 1: DH of a SCARA Robot
0
T4 0 T1 1T2 2 T3 3 T4 l2 l3
Function: homogeneous
def dh(d,theta,a,alpha): # complete this
transformation from DH parameters
# Symbolic variables
q1, q2, q3, q4 = symbols("q1 q2 q3 q4")
l1, l2, l3, l4 = symbols("l1 l2 l3 l4")
60
Example 1: DH of a SCARA Robot
1 l1 180+q1 l2 0 1 l1 q1 l2 0 180°
2 0 -90+q2 l3 0 2 0 q2 l3 0 -90°
3 -l4+q3 0 0 0 3 q3 0 0 0 -l4
4 0 90+q4 0 180 4 0 q4 0 180 90°
% Initial lengths
l1=1; l2=1; l3=1; l4=0.5;
It uses DH parameters
% Definition of the robot using DH (th,d,a,alfa,P/R)
without including the
L(1)=Link([0, l1, l2, 0, 0]);
initial configuration (the
L(2)=Link([0, 0, l3, 0, 0]);
joint variable q is set to 0)
L(3)=Link([0, 0, 0, 0, 1]);
L(4)=Link([0, 0, 0, pi, 0]); The value P/R means:
% Robot creation 0 = revolute joint
scara = SerialLink(L, 'name', 'scara'); 1 = prismatic joint
http://petercorke.com/wordpress/toolboxes/robotics-toolbox 62
Example 1: DH of a SCARA Robot
l2 l3
l4
l1
z0
y0 x4
x0
y4
z4
63
Example 2: DH of the Fanuc M-10iA Robot
64
Example 2: DH of the Fanuc M-10iA Robot
640
200
600
150
z0 z0 450
y0 x0
x0
z5 640
z3
z3
200
z5
z2
z4
600
150
z1
z0 z0 450
y0 x0
x0
- Axis zi
- Origin of frame {i} 67
Example 2: DH of the Fanuc M-10iA Robot
1. Reference frames
z5 640
z3 x3 y 3 x5
x4
y4 z3 x3
x2
x4 x2 200
y5
z5 y4 y2
y2 z2
x5 z4
600
x1 150
z1 x1
y1 y1
z0 z0 450
y0 x0
x0
- Axis xi
- Axis yi 68
Example 2: DH of the Fanuc M-10iA Robot
1. Reference frames
z5 640
z3 x3 y 3 x5
x4
y4 z3 x3
x2
x4 x2 200
y5 z6
z5 y4 y2
y2 z2 x6
x5 z4
600
z6 y6
x6 x1 150
z1 x1
y1 y1
z0 z0 450
y0 x0
x0
640
z3 x3 y 3 z5
x4
x2 x5 y4 z3 x3
y5 x4 x2 200
z5 y4 z6
y2 z2 y2
x5 z4 x6
z6 y6 600
x6 x1
150
z1 x1
y1 z0 y1
z0 450
x0 y0 x0
70
Example 2: DH of the Fanuc M-10iA Robot
3. Homogeneous transformation matrices
Joint i di θi ai αi Joint i di θi ai αi
1 450 180+q1 -150 90 4 640 180+q4 0 90
2 0 90+q2 600 0 5 0 180+q5 0 90
3 0 180+q3 -200 90 6 0 q6 0 0
0 1 0 450 0 1 0 640
0 0 0 1 0 0 0 1
0 0 1 0 0 1 0 0
0 0 0 1 0 0 0 1
0 1 0 0 0 0 1 0
0 0 0 1 0 0 0 1
71
Example 2: DH of the Fanuc M-10iA Robot
3. Homogeneous transformation matrices
72
Example 2: DH of the Fanuc M-10iA Robot
# Symbolic variables
q1, q2, q3, q4, q5, q6 = symbols("q1 q2 q3
q4, q5, q6")
% Homogeneous transformations
Using symbolic variables to T1 = dh(450, pi+q1, -150, pi/2);
compute each homogeneous T2 = dh(0, q2+pi/2, 600, 0);
transformation T3 = dh(0, q3+pi, -200, pi/2);
T4 = dh(640, q4+pi, 0, pi/2);
T5 = dh(0, q5+pi, 0, pi/2);
T6 = dh(0, q6, 0, 0);
% Final homogeneous transformation
Tf = simplify(T1*T2*T3*T4*T5*T6)
73
Example 2: DH of the Fanuc M-10iA Robot
% Visualization
fanuc.plot([pi pi/2 pi pi pi 0]);
http://petercorke.com/wordpress/toolboxes/robotics-toolbox 74
Example 2: DH of the Fanuc M-10iA Robot
z6 y6
x6
z0
x0 y0
75
References
76