Inverse Kinematics
Inverse Kinematics
q (1 , 2 , n ) y
Find the joint variables
which can bring the robot x
to the desired
configuration.
Solvability
0
Given the numerical value of T we attempt to
N
find values of 1 , 2 ,, n .
The PUMA 560:
LHS(i,j) = RHS(i,j)
column
row j = 1, 2, 3, 4
i = 1, 2, 3
Solution To Inverse
Kinematics
General Approach: Isolate one joint variable at a time
function of q3, … , qN
function of q1, q2
only one unknown q2 since q1 has been solved for
• Look for constant elements of 2TN
• Equate LHS(i,j) = RHS(i,j)
• Solve for q2
• Maybe can find equation involving q1 only
Note:
– There is no algorithmic approach that is
100% effective
– Geometric intuition is required
A Simple Example
Revolute and
Finding :
Prismatic
y
Joints θ arctan( )
Combined x
More Specifically:
(x , y)
y arctan2() specifies that it’s in the
θ arctan 2( ) first quadrant
x
Y
S
1 Finding S:
X
S (x 2 y 2 )
Inverse Kinematics of a Two Link
Manipulator
(x , y) Given: l1, l2 , x , y
2 Find: 1, 2
l2 Redundancy:
A unique solution to this
problem does not exist. Notice, that
using the “givens” two solutions are
1
l1
possible.
Sometimes no solution is possible.
(x , y)
The Geometric
Solution (x , y)
l2
2
l1
1
The Geometric
Solution (x , y) Using the Law of Cosines:
l2
2
c 2 a 2 b 2 2ab cos C
2 2
( x 2 y 2 ) l1 l2 2l1l2 cos(180 θ 2 )
cos(180 θ 2 ) cos(θ 2 )
2 2
l1 x 2 y 2 l1 l2
cos(θ 2 )
2l1l2
1
x 2 y 2 l12 l2 2
θ 2 arccos
2l1l2
Using the Law of Cosines:
Redundant since 2 could be in the
sin B sin C
first or fourth quadrant.
b c
sin θ1 sin(180 θ 2 ) sin(θ 2 )
Redundancy caused since 2 has two
l2 x y
2 2
x 2 y2 possible values
θ1 θ1 α l sin(θ ) y
θ1 arcsin 2 2
arctan 2
y x 2 y2 x
α arctan 2
x
The Algebraic Solution
l2 (x , y)
2
l1
1
The Algebraic Solution
l2 (x , y)
2
c 1 cos θ 1
c 1 2 cos( θ 2 θ 1 )
l1 (1) x l1 c 1 l 2 c 1 2
(2) y l1 s 1 l 2 sin 1 2
1
(3) θ θ 1 θ 2
(1) 2 ( 2) 2 x 2 y 2
2 2 2
2 2 2
l1 c1 l2 (c1 2 ) 2 2l1l2 c1 (c1 2 ) l1 s1 l2 (sin 1 2 ) 2 2l1l2 s1 (sin 1 2 )
l1 l2 2l1l2 c1 (c1 2 ) s1 (sin 1 2 )
2 2
2 2
l1 l2 2l1l2 c 2 Only Note :
Unknown
x y l1 l22 2 2 2
cos(ab) (cosa)(cosb)(sin a)(sinb
θ 2 arccos
2l1l2 sin(ab) (sin a)(cosb)(cosa)(sinb
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(ab) (cosa)(cosb) (sina)(sinb)
c 1 ( l1 l 2 c 2 ) s 1 ( l 2 s 2 ) sin(ab) (cosa)(sinb) (cosb)(sina)
1
( l1 l 2 c 2 )
x l 2 s 2 s 1 ( l1 2 l 2 2 2 l1 l 2 c 2 ) Notice this is the law of
cosines and can be replaced
by x2+ y2
y ( l1 l 2 c 2 ) x l 2 s 2 y ( l1 l 2 c 2 ) x l 2 s 2
s1 θ 1 arcsin
x2 y2 x2 y2
Inverse Kinematics
• Analytical solution only works for a fairly
simple structure
θ2
l2
l1
θ1 C=(Cx,Cy)
Base (0,0)
Iterative Approaches
Find the joint angles θ that minimizes the distance between
the hypothesized character position and user specified
position
arg min f i ( ) Ci
2
i
hypothesized specified
position position
θ2
l2
l1
θ1 C=(Cx,Cy)
Base (0,0)
Iterative Approaches
Find the joint angles θ that minimizes the distance between
the hypothesized character position and user specified
position
θ2
l2
l1
θ1 C=(c1,c2)
Base (0,0)
Iterative Approaches
Mathematically, we can formulate this as an
optimization problem:
arg min f i ( ) ci
2
i
arg min f i ( k k ) ci
2
i
Gauss-Newton Approach
Step 1: initialize the joint angles with 0
arg min f i ( k k ) ci
2
Known!
Gauss-Newton Approach
Step 1: initialize the joint angles with 0
arg min
k f i
( k
k
) ci
2
Taylor series expansion
i
Gauss-Newton Approach
Step 1: initialize the joint angles with 0
arg min
k f i
( k
k
) ci
2
Taylor series expansion
i
2
f i rearrange
arg min
k
i i
f ( k
)
k
k
ci
Gauss-Newton Approach
Step 1: initialize the joint angles with 0
arg min
k f i
( k
k
) ci
2
Taylor series expansion
i
2
f i rearrange
arg min
k
i i
f ( k
)
k
k
ci
arg min
k f i (
k
k
) ci 2
Taylor series expansion
i
2
f i rearrange
arg min
k
i i
f ( k
)
k
k
ci
2
f i k
arg min
k
i k k
( ci f i ( ))
Linear equation!
Gauss-Newton Approach
• Optimizing an quadratic function is easy
2
f
arg min ik k (ci f i ( k ))
i
( J T J ) 1 J T b