Chương 05
Chương 05
Robotics
1
Tài liệu tham khảo
2
Contents
Topic 1: Introduction
Topic 2: Basic robotic concepts
Topic 3: Spatial Representations of Rigid Bodies
Topic 4: Forward Kinematics of Robot Manipulators
Topic 5: Inverse Kinematics of Robot Manipulators
3
- Topic 5 -
4
Objectives
5
Outline
1. Introduction
3. Multiplicity of solutions
4. Analytic solutions
5. Numeric solutions
{n}
qi+1
x = f (q)
Forward
Joint Kinematics Operational
space space
q = (q1 , , qn ) x = ( x, y , z , , , )
Given q = ( q1 , , qn )
Find
0
Tn (q)or x = f (q) For example: x = ( x, y, z , , , )
Kinematics of Robot Manipulators
Joint Operational
space space
q = (q1 , , qn ) x = ( x, y , z , , , )
Inverse
kinematics
q = f −1 (x)
Inverse kinematics
Find the joint configuration needed to achieve a certain position/orientation (pose) for some part of
the robot
Given 0 Tn (q) or x = f (q) for some point of the robot (e.g. end effector)
Find q = ( q1 , , qn )
Kinematics of Robot Manipulators
Example: R-R Robot
1. Position of a 2 dof robot
ŷ
y Cartesian Joint
variables variables
x q
l2 x= q = 1
q2 y q2
l1 Considering only
position
q1
x x̂
Position and
Orientation
where:
Stanford Manipulator
Kinematics of Robot Manipulators
Example: Inverse Kinematics Compute the angles that achieve the following pose for the end
effector:
Numeric
matrix
¡System of nonlinear
trigonometric equations!
Stanford Manipulator
Inverse Kinematics
2. It is a synthesis problem
3. The input data (position and orientation) are of the form:
R t x
T = x = p
0 0 0 1 xr
Classical formulation: Generalized formulation:
Inverse kinematics for the end effector Inverse kinematics for task variables
4. It is a nonlinear problem:
• Is there a solution?
• Is there a unique solution, or multiple solutions? Answer: workspace,
• How to solve it? redundancy
Outline
1. Introduction
3. Multiplicity of solutions
4. Analytic solutions
5. Numeric solutions
WS = {p 2
:| l1 − l2 |‖ p‖ l1 + l2 }
with q1 ∈ [0, 2π], q2 ∈ [0, 2π]
- For all p ∈ WS2 there is (at least) one solution for every orientation
1. Example:
ABB’s IRB 360 robot
1. Introduction
3. Multiplicity of solutions
4. Analytic solutions
5. Numeric solutions
Multiplicity of solutions
PUMA 560
Multiplicity of Solutions
d1 =‖ q1 − q A‖ Shortest distance is
preferred
d 2 =‖ q 2 − q A‖
Redundancy
- n joints: q = (q1 , , qn )
- Task space: x = ( x1 , x2 , , xm )
m: dimension of the task space
Complexity
1. Equation are nonlinear
2. There can be:
• One solution
• Multiple solutions
• Infinite solutions (when there is redundancy)
• No admissible solution (outside the workspace)
3. When is the existence of a solution guaranteed for the position?
• When the position (of the end effector) belongs to the reachable workspace
• When is the existence of a solution guaranteed for the pose?
• When the pose (of the end effector) belongs to the dexterous workspace
Inverse Kinematics
Solution Methods
1. Analytic Solution (exact)
It is preferred, when it can be found
Methods:
• Geometric ad-hoc approach
• Algebraic approach (solution of polynomial equations)
• Systematic reduction approach (obtain a reduced set of equations)
• Kinematic decoupling (Pieper): robots with 6 dof.
• When the last 3 axes are revolute, and they intersect each other (spherical wrist).
2. Numeric Solution (iterative)
• Needed when there is redundancy: n > m
• Easier to obtain (slower run time?)
• They use the Jacobian matrix of the forward kinematics
• Usual methods: Newton, gradient descent, etc.
Outline
1. Introduction
3. Multiplicity of solutions
4. Analytic solutions
5. Numeric solutions
ŷ
y
l2
l1 q2
q1
x x̂
Geometric Solutions
1. Example 1: Find the inverse kinematics for the position of the R-R robot using a geometric
approach ŷ
y
Solution
l l2
For q2 : q2
l1
- Using the law of cosines:
q1
l 2 = l12 + l22 − 2l1l2 cos(180 − q2 ) x x̂
For q1 (using the geometry of the figure)
x 2 + y 2 = l12 + l22 + 2l1l2 cos(q2 )
q1 = −
x + y − (l + l2 )
2 2 2 2
c2 = 1
= atan2( y, x)
2l1l2
- Using a trigonometric identity:
= atan2(l2 s2 , l1 + l2 c2 )
s22 + c22 = 1
Inverse kinematics:
s2 = 1 − c 2
2 q1 = atan2( y, x) − atan2(l2 s2 , l1 + l2 c2 )
q2 = atan2( s2 , c2 ) q2 = atan2( s2 , c2 )
Geometric Solutions
ye
xe ye
l2
xe
l2
l1
y0
l1
x0
yW y0
xW x0
l0
zB
l0
xB
31
Geometric Solutions
Example 2: Find the inverse kinematics for the position of the R-R-R robot
using a geometric approach.
Apply the “law of cosines” to solve for 𝜃2 y0
(𝑥 − 𝑙3 𝑐123 )2 + 𝑦 − 𝑙3 𝑠123 2 = 𝑙12 + 𝑙22 − 2𝑙1 𝑙2 cos 180 − 𝜃2 (G1)
y
Where 𝑥1 = 𝑥 − 𝑙3 𝑐123 and 𝑦1 = 𝑦 − 𝑙3 𝑠123 .
l3
Because cos 180 − 𝜃2 = − cos −𝜃2 = − cos 𝜃2 ,
𝑥12 +𝑦12 −𝑙12 −𝑙22
cos 𝜃2 = 2𝑙1 𝑙2
(G2) y1
l2
sin 𝜃2 = ± 1 − cos2 𝜃2 (G3)
There are two solutions for 𝜃2 which can be positive or negative values l1
To solve for 𝜃1 y
𝛽 = 𝑎𝑡𝑎𝑛2 𝑦1 , 𝑥1 (G4)
By apply the law of cosines to find ψ: q1
x1 x x0
𝑥12 +𝑦12 +𝑙12 −𝑙22
cos 𝜓 = (G5)
2𝑙1 𝑥12 +𝑦12
32
Geometric Solutions
The arccosine must be solved so 0 ≤ 𝜓 ≤ 180𝑜 in order that the
geometry which leads to (G6) will be preserved
y0
𝜃1 = 𝛽 ± 𝜓 (G6)
y
Where the plus sign is used if 𝜃2 < 0 and the minus sign if 𝜃2 >
l3
0.
To solve 𝜃3 y1
l2
𝜃3 = 𝜃 − 𝜃1 − 𝜃2
l1
y
q1
x1 x x0
33
Algebraic Solutions
Example:
Find the inverse kinematics for the position of the RR robot using an algebraic approach
Solution - Forward kinematics: c12 − s12 0 l1c1 + l2 c12 cosy − siny 0 0
x2 ŷ
s
0 l1s1 + l2 s12 siny cosy 0
0 y2 0 y
T2 =
c12
T2 = 12
0 0
2
0 0 1 0 0 0 1 0
l2
0 0 0 1 0 0 0 1
q2
l1
- For q2 :
From
0
x2 2 = l12 c12 + l2 2 c12 2 + 2l1c1l2 c12 q1
F.K.
y2 2 = l12 s12 + l2 2 s12 2 + 2l1s1l2 s12
0 0
x2 x̂
0
x2 2 + 0 y2 2 = l12 + l2 2 + 2l1l2 (c1c12 + s1s12 ) s22 + c22 = 1
0
x2 2 + 0 y2 2 = l12 + l2 2 + 2l1l2 c2 s2 = 1 − c22
x2 2 + 0 y2 2 − (l12 + l2 2 )
0
c2 = q2 = atan2( s2 , c2 )
2l1l2
Algebraic Solutions
In matrix form:
y2 (l1 + l2 c2 ) −0 x2l2 s2
0
1. Example 2
For a 3-dof robot, its end effector pose with respect to its base is given by
where a3 and d1 are constants. The desired pose for the end effector is:
Find the inverse kinematics (𝜃1 , 𝜃2 , 𝑞2 ) of this robot as a function of the elements of Tdes.
Solution
The procedure consists in obtaining relations between both matrices, and applying
some algebra, so that the value for each joint can be solved.
Algebraic Solutions
1. Example 2
- Finding 𝜃1 :
- Finding 𝜃3 :
- Finding 𝜃2 :
Algebraic solution by reduction to
polynomial
38
Inverse kinematic Examples
39
Outline
1. Introduction
3. Multiplicity of solutions
4. Analytic solutions
5. Numeric solutions
41
Numeric Solutions
f (q) n m
J (q) = J (q)
3. They use the Jacobian matrix: q
a) Newton’s Method
1. Problem: given a (constant) xd, find q such that xd: desired value for x
f : forward kinematics function
x d − f (q) = 0
2. Procedure for the solution
• First order Taylor approximation for f(q)
f (q k )
f (q) f (q k ) + J (q k )(q − q k ) J (q k ) =
q
• Replacing: x d − ( f (q k ) + J (q k )(q − q k ) ) = 0 Jacobian matrix
x d − f (q k ) = J (q k )(q − q k )
q k +1 = q k + J −1 (q k ) ( x d − f (q k ) )
Numeric Solutions
a) Newton’s Method
1. Algorithm:
Start with an initial q0 (usually the current configuration)
Iteratively update using:
q k +1 = q k + J −1 (q k ) ( x d − f (q k ) ) k = 0,1,2,3,…
Stop when:
‖ x d − f (q k )‖ or ‖ q k +1 − q k‖ : small value
Small Cartesian error Small joint increment
2. Comments:
• Convergence if we start with q0 (initial value) close to the solution
• When there is redundancy (m < n):
• J is not square (and there is no inverse)! → we use the pseudo-inverse
Disadvantages:
• Computation time of the inverse (or pseudo-inverse)
• Problems near singularities of J (Jacobian matrix)
Advantage: it is fast (quadratic convergence)
Numeric Solutions
a) Newton’s Method
1. Example: RR robot
Compute the joint values needed for the end effector to be at x = 1.2, y = 1.2 using Newton’s
method. Assume that l1 = l2 = 1.
ŷ
Solution c + c
- Forward kinematics: f (q) = 1 12 y
s1 + s12
l2
- Jacobian matrix:
l1 q2
f x f x
q2 −( s1 + s12 ) q1
f (q) q1 = − s12
J (q) = =
q f y f y c + c c12 x x̂
1 12
q1 q2
Desired position:
- Inverse of the Jacobian:
1.2
1 c12 s12 xd =
J −1 (q) = −(c + c ) − ( s + s ) 1.2
s2 1 12 1 12
Numeric Solutions
a) Newton’s Method
1. Example: RR robot
Compute the joint values needed for the end effector to be at x = 1.2, y = 1.2 using Newton’s
method. Assume that l1 = l2 = 1.
Solution - Expression for Newton’s method:
q k +1 = q k + J −1 (q k )(x d − f (q))
- Replacing the previous values:
- It is iteratively applied
For example, use q1 = 0.5 y q2 = 0.5 as initial values (note: we cannot start with q2 = 0
since J-1 would not exist)
Numeric Solutions
a) Newton’s Method
function [q1,q2,i]=NewtonIK(x,y,q01,q02)
1. Example: RR robot epsilon = 1e-3;
max_iter = 100; %Maximum number of iterations
xd=[x,y]';
q=[q01,q02]';
%Iterations: Newton's method
for i=1:max_iter
q1 = q(1); q2 =q(2);
J =[-sin(q1)-sin(q1+q2), -sin(q1+q2);...
cos(q1)+cos(q1+q2), cos(q1+q2)];
f = [cos(q1)+cos(q1+q2), sin(q1)+sin(q1+q2)]';
e = xd-f;
q = q + inv(J)*e;
%End condition
if (norm(e) < epsilon)
break
end
end
end
Numeric Solutions
a) Newton’s Method
1. Example: RR robot
Note that the result depends on the initial value.
Results: 0.2278 1.3430
q= q=
1.1157 −1.1152
Final configuration when the initial Final configuration when the initial
value was q=[0.5; 0.5] value was q = [1; -1]
(Generic Gradient Descent)
1. Objective:
• Minimize the generic function g (q)
min g (q)
q
2. Idea:
• Start with an initial value q0
• “Move” in the negative direction of the gradient (𝛻g), iteratively
q k +1 = q k − g (q k ) +
: size of the step
• The step size α > 0 must guarantee a maximum descent of g(q) in every iteration:
α very high: it can lead to divergence (the minimum is not found)
α very small: it generates a slow convergence
q k +1 = q k + J T (q k ) ( x d − f (q k ) )
3. Pros: computationally simpler (transpose instead of inverse)
4. Cons: there can be a slow convergence
Numeric Solutions
- It is iteratively applied.
For example, use q1 = 0.5 y q2 = 0.5 as initial values (in this case we can start with
q2 = 0)
Numeric Solutions
Comparison
1. Newton’s method
• Quadratic convergence rate (it is fast)
• Problems near singularities (singularities can be computed using the singular values of J)
2. Gradient descent method
• Linear convergence rate (it is slow)
• It does not have singularity problems
• The step size (α) must be carefully chosen (but there exist adaptive methods such as line
search)
3. Efficient algorithm:
• Start with the gradient descent method (safe, but slow)
• Then switch to Newton’s method
Outline
1. Introduction
3. Multiplicity of solutions
4. Analytic solutions
5. Numeric solutions
1. Example
Consider the following forward kinematics (R-R Robot with l1 = l2 = 1):
f x (q) cos(q1 ) + cos(q1 + q2 )
f (q) = =
f y (q ) sen( q1 ) + s en ( q1 + q2
)
Compute the Jacobian numerically when the joint values are q1 = 0.5, q2 = 1.0
Solution
f x f x
- The Jacobian is: q q2
J (q) =
1
f y f y
q1 q2
f y
=
f y (q1 + q1 , q2 ) − f y (q1 , q2 )
=
sen(q1 + q1 ) + sen((q1 + q1 ) + q2 ) − ( sen(q1 ) + sen(q1 + q2 ) )
q1 q1 q1
Numeric Computation of the Jacobian
1. Example
Consider the following forward kinematics (R-R Robot with l1 = l2 = 1):
f x (q) cos(q1 ) + cos(q1 + q2 )
f (q) = =
y sen(q1 ) + sen(q1 + q2 )
f (q )
Compute the Jacobian numerically when the joint values are q1 = 0.5, q2 = 1.0
Solution f x f x
- The Jacobian is: q q2
J (q) =
1
f y f y
q1 q2
f y
=
f y (q1 , q2 + q2 ) − f y (q1 , q2 )
=
sen(q1 ) + sen(q1 + (q2 + q2 )) − ( sen(q1 ) + sen(q1 + q2 ) )
q2 q2 q1
Numeric Computation of the Jacobian
1. Example
- Using Δq1 = Δq2 = 0.001:
f y
=
( sen(0.5 + 0.001) + sen(0.5 + 0.001 + 1.0) ) − ( sen(0.5) + sen(0.5 + 1.0) ) = 0.9476
q1 0.001
f y
=
( sen(0.5) + sen(0.5 + 1.0 + 0.001) ) − ( sen(0.5) + sen(0.5 + 1.0) ) = 0.0702
q2 0.001
1. Inverse kinematics finds joint configurations given a desired position and orientation (pose)
2. In inverse kinematics, there can be a single solution, many solutions, infinite solutions, or no
solution (the existence of solutions is defined by the workspace)
3. Analytic solutions are more complex to find, less systematic and applicable mainly to simple
cases
4. Numeric solutions are more generic, and they can be applied to all the cases
59
Exercises
60
References
• B. Siciliano, L. Sciavicco, L. Villani, y G. Oriolo. Robotics: modelling, planning and control. Springer
Science & Business Media, 2010 (Chapter 2.12)
• M.W. Spong, S. Hutchinson, y M. Vidyasagar. Robot Modeling and Control. John Wiley & Sons,
2006 (Chapter 1.4, 3.3)
• K. Lynch and F. Park. Modern Robotics: Mechanics, Planning, and Control. Cambridge University
Press, 2017 (Chapter 6.1-6.2)
• John J. Craig, Introduction to Robotics Mechanics and Control, Pearson Prentice Hall.
Thank you for your listening
64