Professional Documents
Culture Documents
Inverse kinematics
Prof. Alessandro De Luca
Robotics 1 1
Inverse kinematics
what are we looking for?
n 𝑊𝑆9 Í 𝑊𝑆7
Robotics 1 4
Workspace of Fanuc R-2000i/165F
section for a
constant angle 𝑞7
𝑊𝑆7 ⊂ ℝ;
(≈ 𝑊𝑆9 for spherical wrist
without joint limits)
rotating the
base joint angle 𝑞7
Robotics 1 5
Workspace of a planar 2R arm
2 orientations
𝑦 𝑝 = 𝑂𝑃 if 𝑝 Î int(𝑊𝑆7 )
•
𝑃
= 𝑊𝑆7 − 𝜕𝑊𝑆7
𝑙2
𝑞2
𝑙7 + 𝑙9 𝑂•
𝑙1
𝑞1 𝜕𝑊𝑆7
𝑙7 − 𝑙9
4 inverse solutions
out of singularities
(for the position of
the wrist center only)
Robotics 1 7
Counting/visualizing the 8 solutions
of the inverse kinematics for a Unimation Puma 560
RIGHT UP
RIGHT DOWN
LEFT UP
LEFT DOWN
Robotics 1 8
Inverse kinematic solutions of UR10
6-dof Universal Robot UR10, with non-spherical wrist
video (slow motion)
desired pose
−0.2373
p = −0.0832 [m]
1.3224
3/2 0.5 0
R = −0.5 3/2 0
0 0 1
home configuration at start
𝑞= 0 −𝜋/2 0 −𝜋/2 T
0 0
[rad]
Robotics 1 9
8 inverse kinematic solutions of UR10
Robotics 1 10
Multiplicity of solutions
few examples
)𝑇
b =
end-effector
𝑎 ± 𝑎9 + 𝑏9 − 𝑐 9
⇒ 𝑢7,9 = ⇒ 𝜃7,9 = 2 arctan 𝑢7,9
𝑏+𝑐
only if argument is real, else no solution
Robotics 1 13
A planar 3R arm
workspace and number/type of inverse solutions
𝑦 𝑞; 𝑝 𝑙7 = 𝑙9 = 𝑙; = 𝑙 𝑛 = 3, 𝑚 = 2
𝑝𝑦 •
𝑙3 𝑊𝑆7 = 𝑝 ∈ ℝ9: 𝑝 ≤ 3𝑙 ⊂ ℝ9
𝑙2 𝑞9
𝑊𝑆9 = 𝑝 ∈ ℝ9: 𝑝 ≤ 𝑙 ⊂ ℝ9
𝑙1
any planar orientation is feasible in 𝑊𝑆9
𝑞7 𝑥
𝑝𝑥
1. in int 𝑊𝑆7 , except for case 3: ∞7 regular solutions,
at which the E-E can take a continuum of ∞
orientations (but not all orientations in the plane!)
2. if 𝑝 = 3𝑙 : only 1 solution, singular
3. if 𝑝 = 𝑙 : ∞7 solutions, 3 of which singular
⇒ lmin= l3 = 0.3
Exercise #3 in
classroom test
of 21 Nov 2014
⇒ 0.5
Rin = 0,
Robotics 1 15
Multiplicity of solutions
summary of the general cases
n if 𝑚 = 𝑛
n ∄ solutions
video
Robotics 1 18
Inverse kinematics of planar 2R arm
𝑦
•
𝑃 direct kinematics
𝑝𝑦
𝑙2 𝑝v = 𝑙7𝑐7 + 𝑙9𝑐79
𝑞2
𝑝w = 𝑙7𝑠7 + 𝑙9𝑠79
𝑙1
𝑞1 𝑥 data 𝑞7, 𝑞9 unknowns
𝑝𝑥
“squaring and summing” the equations of the direct kinematics
𝑝v9 + 𝑝w9 − 𝑙79 + 𝑙99 = 2𝑙7𝑙9 𝑐7𝑐79 + 𝑠7𝑠79 = 2𝑙7𝑙9𝑐9
and from this
𝑐9 = 𝑝v9 + 𝑝w9 − 𝑙79 + 𝑙99 y2𝑙7𝑙9, 𝑠9 = ± 1 − 𝑐99 𝑞9 = atan2 𝑠9 , 𝑐9
𝑙1
𝑞7 a
𝑝𝑥 𝑥
2 solutions
(one for each value of 𝑠2)
𝑞7 = atan2 𝑝w , 𝑝v − atan2 𝑙9 𝑠9 , 𝑙7 + 𝑙9 𝑐9
note: difference of atan2’s needs
to be re-expressed in (−𝜋 , 𝜋]!
𝑞9~~
• p
{𝑞7, 𝑞9}UP/LEFT 𝑞9~ {𝑞7, 𝑞9}DOWN/RIGHT
𝑝v 𝑞1
symmetric structure without offsets
e.g., first 3 joints of Mitsubishi PA10 robot
Robotics 1 23
Inverse kinematics of 3R elbow-type arm
step 1
𝐿2
𝑞3 𝑝v = 𝑐7 𝐿9𝑐9 + 𝐿;𝑐9;
𝑞2 direct
𝐿3 𝑝w = 𝑠7 𝐿9𝑐9 + 𝐿;𝑐9;
kinematics
𝑑1 𝑝𝑧 𝑝‚ = 𝑑7 + 𝐿9𝑠9 + 𝐿;𝑠9;
𝑝𝑦
𝑝v 𝑞1
𝑝v9 + 𝑝w9 + 𝑝‚ − 𝑑7 9
= 𝑐79 𝐿9 𝑐9 + 𝐿; 𝑐9; 9
+ 𝑠79 𝐿9 𝑐9 + 𝐿; 𝑐9; 9
+ 𝐿9 𝑠9 + 𝐿; 𝑠9; 9
𝐿2
𝑞3 𝑝v = 𝑐7 𝐿9𝑐9 + 𝐿;𝑐9;
𝑞2 direct
𝐿3 𝑝w = 𝑠7 𝐿9𝑐9 + 𝐿;𝑐9;
kinematics
𝑑1
𝑝‚ = 𝑑7 + 𝐿9𝑠9 + 𝐿;𝑠9;
𝑝𝑧
𝑝𝑦
𝑐7 = 𝑝v y± 𝑝v9 + 𝑝w9
only when 𝑝v9 + 𝑝w9 >0…
(else 𝑞1 is undefined —infinite solutions!) 𝑠7 = 𝑝w y± 𝑝v9 + 𝑝w9
𝑞7ˆ = atan2 𝑝w , 𝑝v
again, two solutions
𝑞7r = atan2 −𝑝w , −𝑝v
Robotics 1 25
Inverse kinematics of 3R elbow-type arm
step 3
Robotics 1 26
Inverse kinematics
for robots with spherical wrist
last 3 joints RRR, with
𝑧4 𝑦6
axes intersecting in 𝑊
j6 𝑊 𝑥6
first 3 robot joints 𝑂b = 𝑝
of any type (RRR, RRP, PPP, …)
𝑧3 𝑧5 𝑧6 = 𝑎
𝑧0 j5 𝑑6
j4
find 𝑞7, ⋯ , 𝑞b from the input data
𝑦0
§ 𝑝 (origin 𝑂b)
𝑥0 j1 § 𝑅 = 𝑛 𝑠 𝑎 (orientation of 𝑅𝐹b)
1. 𝑊 = 𝑝 − 𝑑b𝑎 ⇒ 𝑞7, 𝑞9, 𝑞; (inverse “position” kinematics for main axes)
)
2. 𝑅 = 𝑅;(𝑞7,𝑞9,𝑞;) ;𝑅b(𝑞`,𝑞Ž,𝑞b) ⇒ ;𝑅b 𝑞`,𝑞Ž,𝑞b = )𝑅;' 𝑅 ⇒ 𝑞`, 𝑞Ž, 𝑞b
Euler 𝑍𝑌𝑍 or 𝑍𝑋𝑍 (inverse “orientation”
given known, two regular kinematics for the wrist)
after step 1 rotation matrix with
solutions
Robotics 1 𝑞` ,𝑞Ž ,𝑞b (𝜃` ,𝜃Ž ,𝜃b ) 27
6R robot Unimation PUMA 600
spherical 𝑛 = 0𝑥6(𝑞)
wrist
𝑠 = 0𝑦6(𝑞)
a function of
𝑞7 , 𝑞9 , 𝑞; only!
𝑎 = 0𝑧b (𝑞)
𝑝 = 𝑂6(𝑞)
§ the most complex inverse kinematics that can be solved in principle in closed
form (i.e., analytically) is that of a 6R serial manipulator, with arbitrary DH table
§ ways to systematically generate equations from the direct kinematics that could be
easier to solve ⇒ some scalar equations may contain perhaps a single unknown variable!
) ) 7
𝑇b = 𝐴7 𝜃7 𝐴9 𝜃9 ⋯ Ž𝐴b 𝜃b = 𝑈)
method used for the
Unimation PUMA 600 in (*)
) r7 )
𝐴7 𝑇b = 𝑈7 (= 7𝐴9 ⋯ Ž𝐴b ) )
𝑇b Ž𝐴r7 ) `
b = 𝑉Ž (= 𝐴7 ⋯ 𝐴Ž )
7 r7 ) r7 )
𝐴9 𝐴7 𝑇b = 𝑈9 = 9𝐴; ⋯ Ž𝐴b or also ...
)
𝑇b Ž𝐴r7
b
` r7
𝐴Ž = 𝑉` = )𝐴7 ⋯ ;𝐴`
⋯ ⋯
` r7
𝐴Ž ⋯ 7𝐴r7
9
) r7 )
𝐴7 𝑇b = 𝑈Ž (= Ž𝐴b ) )
𝑇b 𝐴b 𝐴Ž ⋯ 7𝐴r7
Ž r7 ` r7 )
9 = 𝑉7 (= 𝐴7 )
(*) Paul, Shimano, and Mayer: IEEE Transactions on Systems, Man, and Cybernetics, 1981
§ generating from the direct kinematics a reduced set of equations to be solved (setting
w.l.o.g. 𝑑7 = 𝑑b = 0) ⇒ 4 compact scalar equations in the 4 unknowns 𝜃9 , … , 𝜃Ž
) 𝑛 𝑠 𝑎 𝑝 )
𝑎‚ = 𝑎 ' 𝜃 𝑧 𝑝 9 = 𝑝' 𝜃 𝑝(𝜃) solved analytically
𝑇b = = 𝐴b 𝜃
0 0 0 1 '
𝑝‚ = 𝑝 𝜃 𝑧 𝑝' 𝑎 = 𝑝' 𝜃 𝑎 𝜃 or numerically …
'
𝑧= 0 0 1 … then solve easily for the remaining 𝜃7 and 𝜃b
Robotics 1 29
Numerical solution of
inverse kinematics problems
n use when a closed-form solution 𝑞 to 𝑟Œ = 𝑓4 (𝑞) does not
exist or is “too hard” to be found
•Š– (—)
n all methods are iterative and need the matrix 𝐽4 𝑞 =
•—
(analytical Jacobian)
n Newton method (here only for 𝑚 = 𝑛, at the 𝑘th iteration)
¬ neglected
n 𝑟Œ = 𝑓4 𝑞 = 𝑓4 𝑞 ™ + 𝐽4 𝑞 ™ 𝑞 − 𝑞™ + 𝑜 𝑞 − 𝑞™ in Taylor expansion
𝑞™ˆ7 = 𝑞™ + 𝐽4r7(𝑞™ ) 𝑟Œ − 𝑓4 𝑞™
n convergence for 𝑞) (initial guess) close enough to some 𝑞∗: 𝑓4 (𝑞∗) = 𝑟Œ
n problems near singularities of the Jacobian matrix 𝐽4 𝑞
n in case of robot redundancy (𝑚 < 𝑛), use the pseudo-inverse 𝐽4#(𝑞)
n has quadratic convergence rate when near to a solution (fast!)
Robotics 1 30
Operation of Newton method
n in the scalar case, also known as “method of the tangent”
n for a differentiable function 𝑓(𝑥), find a root 𝑥 ∗ of 𝑓 𝑥 ∗ = 0 by
iterating as
𝑓(𝑥™ )
𝑥™ˆ7 = 𝑥™ − ~
𝑓 𝑥™
an approximating sequence
function
tangent
animation from
http://en.wikipedia.org/wiki/File:NewtonIteration_Ani.gif
Robotics 1 31
Numerical solution of
inverse kinematics problems (cont’d)
n Gradient method (max descent)
n minimize the error function
7 9 7 '
𝐻 𝑞 = 𝑟Œ − 𝑓4 (𝑞) = 𝑟Œ − 𝑓4 (𝑞) 𝑟Œ − 𝑓4 (𝑞)
9 9
𝑞™ˆ7 = 𝑞™ − 𝛼 ∇— 𝐻(𝑞™ )
from
'
' '
∇— 𝐻(𝑞) = 𝜕𝐻(𝑞)⁄𝜕𝑞 =− 𝑟Œ − 𝑓4 𝑞 𝜕𝑓4 (𝑞)⁄𝜕𝑞 = −𝐽4' (𝑞) 𝑟Œ − 𝑓4 (𝑞)
we get
𝑞™ˆ7 = 𝑞™ + 𝛼 𝐽4' (𝑞™ ) 𝑟Œ − 𝑓4 (𝑞™ )
n the scalar step size 𝛼 > 0 should be chosen so as to guarantee
a decrease of the error function at each iteration: too large
values for 𝛼 may lead the method to “miss” the minimum
n when the step size is too small, convergence is extremely slow
Robotics 1 32
Revisited as a feedback scheme
𝑞(0)
𝑟Œ + 𝑒 𝑞̇ ó
𝑞 𝑟Œ = cost
𝐽4' (𝑞) õ
-
𝑟 (𝛼 = 1)
𝑓4 (𝑞)
𝑒 = 𝑟Œ − 𝑓4 𝑞 ® 0 ⟺ closed-loop equilibrium 𝑒 = 0
is asymptotically stable
7 '
𝑉= ³0
9
𝑒 𝑒 is a Lyapunov candidate function
𝑑
𝑉̇ = 𝑒 𝑒̇ = 𝑒
' '
𝑟Œ − 𝑓4 (𝑞) = −𝑒 ' 𝐽4 𝑞 𝑞̇ = −𝑒 ' 𝐽4 𝑞 𝐽4' 𝑞 𝑒 ≤ 0
𝑑𝑡
𝑉̇ = 0 ⟺ 𝑒 ∈ 𝒩 𝐽4' (𝑞) in particular, 𝑒 = 0
𝐽4' (𝑞 ™ )
Robotics 1 35
Error function
n 2R robot with 𝑙7 = 𝑙9 = 1 and desired end-effector position 𝑝Œ = (1,1)
𝑒 = 𝑝Œ − 𝑓4 (𝑞)
(0,0)
𝑞9
Robotics 1 37
Error reduction by Gradient method
n flow of iterations along the negative (or anti-) gradient
n two possible cases: convergence or stuck (at zero gradient)
start
one solution
.
local maximum
.
saddle point
(stop if this is the initial guess) (stop after some iterations)
another start...
(𝑞7 , 𝑞9 )~ = (0, 𝜋/2) (𝑞7 , 𝑞9 )~~ = (𝜋/2, −𝜋/2) (𝑞7 , 𝑞9 )1®v = (−3𝜋/4,0) (𝑞7 , 𝑞9 )¦®ŒŒ¯° = (𝜋/4,0)
𝑞1 𝑝Œ = − 2 2
− 2 2
𝑝Œ 𝑒 ∉ 𝒩(𝐽4' (𝑞)) !!
𝑒 ∈ 𝒩(𝐽4' (𝑞)) the algorithm will
proceed in this case,
moving out of
𝑝 the singularity
𝑝 (𝑞7 , 𝑞9 )1®v = (−3𝜋/4,0) (𝑞7 , 𝑞9 ) = (𝜋/9,0)
Robotics 1 39
Issues in implementation
n initial guess 𝑞)
n only one inverse solution is generated for each guess
n multiple initializations for obtaining other solutions
n optimal step size 𝛼 > 0 in Gradient method
n a constant step may work good initially, but not close to the
solution (or vice versa)
n an adaptive one-dimensional line search (e.g., Armijo’s rule) could
be used to choose the best 𝛼 at each iteration
n stopping criteria
Cartesian error algorithm
(possibly, separate for 𝑟Œ − 𝑓4 𝑞 ™ ≤𝜀 𝑞 ™ˆ7 − 𝑞 ™ ≤ 𝜀—
increment
position and orientation)
Robotics 1 41
Numerical test - 1
n test 1: 𝑞 ) = (0, 0, 1) as initial guess; evolution of the error norm
0.57⋅10-5
Newton
𝑒𝑥
Cartesian errors
component-wise
very fast, converges
in 5 iterations 𝑒𝑦
𝑒𝑧
Robotics 1 0.15⋅10-8 42
Numerical test - 1
n test 1: 𝑞 ) = (0, 0, 1) as initial guess; evolution of joint variables
Robotics 1 43
Numerical test - 2
n test 2: 𝑞 ) = (−𝜋/4, 𝜋/2, 1): singular start
with check of
Newton singularity:
blocked at start
error norms
without check:
it diverges!
Gradient
𝛼 = 0.7
!!
starts toward
solution, but
joint variables
slowly stops
(in singularity):
when Cartesian error
vector 𝑒 ∈ 𝒩 𝐽4' (𝑞)
Robotics 1 44
Numerical test - 3
n test 3: 𝑞 ) = (−𝜋/4, 𝜋/2, 1): doubly singular start
Gradient (with 𝛼 = 0.7) Newton
① starts toward solution is either
error norm
𝑒𝑥
Cartesian errors
joint variables
𝑒𝑦 ➂
➀
𝑒𝑧
Robotics 1 45
Final remarks
n an efficient iterative scheme can be devised by combining
n initial iterations using Gradient (“sure but slow”, linear convergence rate)
n switch then to Newton method (quadratic terminal convergence rate)
n joint range limits are considered only at the end
n check if the solution found is feasible, as for analytical methods
n or, an optimization criterion and/or constraints included in the search
n drive iterations toward an inverse kinematic solution with nicer properties
n if the problem has to be solved on-line
n execute iterations and associate an actual robot motion: repeat steps at
times 𝑡) , 𝑡7 = 𝑡) + 𝑇 , ..., 𝑡™ = 𝑡™r7 + 𝑇 (e.g., every 𝑇 = 40 ms)
n a “good” choice for the initial guess 𝑞 ) at 𝑡™ is the solution of the previous
problem at 𝑡™r7 (provides continuity, requires only 1-2 Newton iterations)
n crossing of singularities and handling of joint range limits need special care
n Jacobian-based inversion schemes are used also for kinematic control,
moving along/tracking a continuous task trajectory 𝑟Œ (𝑡)
Robotics 1 46