### Inverse kinematics

```Inverse Kinematics
Kris Hauser
CS B659: Principles of Intelligent Robot Motion
Spring 2013
Articulated Robot
• Robot: usually a rigid
articulated structure
relative to reference
frames
• A configuration specifies
the placement of those
frames (forward
kinematics)
q2
q1
Inverse Kinematics
• Problem: given desired position of point on robot (end
effector), what joint angles reach it?
Inverse Kinematics
• Problem: given desired position of point on robot (end
effector), what joint angles reach it?
q4
q2
q3
q1
Inverse Kinematics
• Bring point xn on link n to target xT
• Find q s.t. xT = Tn(q)xn
q4
q2
q3
q1
Solving a general equation
• Solve f(q) = 0 (vector valued nonlinear function)
• Can include rotation constraints, multiple IK targets
q4
q2
q3
q1
Two Approaches for IK
• Analytical. Write out the equation in terms of q and
“invert” it
• Sometimes there are simple solutions for certain kinematic
structures (e.g., industrial robots). If so, computation is fast.
• Numerical. Iteratively move q to a solution point f(q)=0
• General purpose
• Can incorporate joint limits easily
• May fall into local minima
Analytical endpoint positioning
for a 2R robot arm
Without loss of generality, let joint 2 and E.E. position lie on x
axis at the reference frame, joint 1 at origin
x(q)-xD = 0
L2
L1
q2
q1
xD
Analytical endpoint positioning
for a 2R robot arm
Without loss of generality (why?), let joint 2 and E.E. position
lie on x axis at the reference frame, joint 1 at origin
x(q)-xD = 0
L2
L1
q2
q1
xD
||x(q)||2 = ||xD||2 (lhs depends only on q2)
||x(q)||2 = (L1 + c2L2)2 + (s2L2)2
= L12 + 2c2L2L1 + c22L22 + s22L22
= L12 + L22 + 2c2L2L1
Analytical endpoint positioning
for a 2R robot arm
Without loss of generality, let joint 2 and E.E. position lie on x
axis at the reference frame, joint 1 at origin
x(q)-xD = 0
L2
L1
q2
q1
xD
||x(q)||2 = ||xD||2 (lhs depends only on q2)
||x(q)||2 = (L1 + c2L2)2 + (s2L2)2
= L12 + 2c2L2L1 + c22L22 + s22L22
= L12 + L22 + 2c2L2L1
c2 = (||xD||2 - L12 - L22)/(2L2L1)
c2(q2)
Elbow up
Elbow down
If rhs > 1, xD is out of reach
If rhs < -1, xD is inside “inner circle”
Analytical endpoint positioning
for a 2R robot arm
Without loss of generality, let joint 2 and E.E. position lie on x
axis at the reference frame, joint 1 at origin
x(q)-xD = 0
q2up
L1
q1
xD
q2down
||x(q)||2 = ||xD||2 (lhs depends only on q2)
||x(q)||2 = (L1 + c2L2)2 + (s2L2)2
= L12 + 2c2L2L1 + c22L22 + s22L22
= L12 + L22 + 2c2L2L1
c2 = (||xD||2 - L12 - L22)/(2L2L1)
c2(q2)
Elbow up
Elbow down
If rhs > 1, xD is out of reach
If rhs < -1, xD is inside “inner circle”
Analytical endpoint positioning
for a 2R robot arm
Without loss of generality, let joint 2 and E.E. position lie on x
axis at the reference frame, joint 1 at origin
x(q)-xD = 0
q2
L1
q1
xD
Once q2 is found, consider angle θD of xD
w.r.t origin
Analytical endpoint positioning
for a 2R robot arm
Without loss of generality, let joint 2 and E.E. position lie on x
axis at the reference frame, joint 1 at origin
x(q)-xD = 0
q2
L1
q1
xD
Once q2 is found, consider angle θD of xD
w.r.t origin
Compute angle θ of E.E. at q=(0,q2)
Analytical endpoint positioning
for a 2R robot arm
Without loss of generality, let joint 2 and E.E. position lie on x
axis at the reference frame, joint 1 at origin
x(q)-xD = 0
L1
q1
xD
q2
Once q2 is found, consider angle θD of xD
w.r.t origin
Compute angle θ of E.E. at q=(0,q2)
Let q1 = θD-θ
Done!
Analytical positioning and
orienting for a 3R robot arm
• Left as an exercise
• Hint: consider solution in prior slides for choosing the first two
joint angles so that the third joint is located at the correct
location. Then pick the third.
Drawbacks to Analytical IK
• Most 6DOF robots encountered in practice are designed to have
convenient analytical IK solutions (e.g., 3 intersecting orthogonal
axes)
• General methods for 6DOF robots require solving a high-degree (16)
polynomial, which is computationally expensive and suffers from
numerical difficulties
• What about a redundant manipulator (> 6 DOF)?
Papers
Multiplicity issue
• Let n = # of DOFs, m = # of constraints
• Roughly, in common cases
• If n < m, there will be 0 IK solutions
• If n = m, there may be 1 or more solution
• If n > m, there will either be 0 or infinite number of solutions
• Singularities: the uncommon case
Null Space
• A motion from q->q’ that maintains f(q)=0 is known as a
motion in the null space.
Null Space
• Null space velocity dq must satisfy J(q)dq = 0
• => dq lies in the null space of J(q)
• For any vector y, (I-J+J)y lies in the null space
• Recall J+ is the pseudoinverse of J
• A basis of the null space can be found by SVD
•
•
•
•
•
•
J = UWVT
Let the last k diagonal entries of W be 0, first n-k nonzero
WVTdq = 0
First n-k entries of VTdq must be zero
Last k entries of VTdq may be non zero
=> Last k columns of V are a basis for null space
Reminder: Project Proposals
• 2-3 paragraphs, due 2/1
• Include:
• Title, group members
• Motivation, significance, and expected demonstration.
• List of 3-4 milestones
• Milestone 1 must be completed, or else you will feel like a total
failure. Usually complete this before spring break.
• Milestone 2 should be completed, or else you will feel bad and will
deserve a less than stellar grade.
• Completing milestone 3 will make you (and me) feel pleased with
• Milestone 4 will make you (and me) very excited, yet is still possible.
(Don‘t promise to cure cancer.)
• Any other details, e.g., implementation, that may be relevant
Recap
• Two general ways of solving inverse kinematics: analytical and
numerical
• With nonredundant manipulators, there are a finite number of
solutions (usually > 1, without joint limits)
• With redundant manipulators, there are an infinite number of
solutions
• Null space motions
```