Documente Academic
Documente Profesional
Documente Cultură
Forward/Inverse kinematics
Jinxiang Chai
Outline
Animation basics:
– Forward kinematics
– Inverse kinematics
Kinematics
The study of movement without the consideration
of the masses or forces that bring about the
motion
Animation
• Robot arm animation (click here)
• Six
• 2-shoulder, 1-elbow, 3-wrist
Configuration Space vs. Work Space
• Configuration space
– The space that defines the possible object
configurations
– Degrees of Freedom
• The number of parameters that are necessary and sufficient
to define position in configuration
• Work space
– The space in which the object exists
– Dimensionality
• R3 for most things, R2 for planar arms
Forward vs. Inverse Kinematics
• Forward Kinematics
– Compute configuration (pose) given individual
DOF values
• Inverse Kinematics
– Compute individual DOF values that result in
specified end effector’s position
Example: Two-link Structure
• Two links connected by rotational joints
θ2
l2
l1
θ1 X=(x,y)
End Effector
Base
Example: Two-link Structure
• Animator specifies the joint angles: θ1θ2
• Computer finds the position of end-effector: x
θ2
l2
l1
θ1 X=(x,y)
End Effector
Base (0,0)
x=f(θ1, θ2)
Example: Two-link Structure
• Animator specifies the joint angles: θ1θ2
• Computer finds the position of end-effector: x
θ2
l2
l1
θ1 X=(x,y)
End Effector
Base (0,0)
x = (l1cosθ1+l2cos(θ2+ θ2)
y = l1sinθ1+l2sin(θ2+ θ2))
Forward Kinematics
• Create an animation by specifying the joint angle
trajectories
θ2
l2
l1
θ1 X=(x,y)
End Effector
Base (0,0) θ1
θ2
Forward Kinematics
• A 2D lamp with 6 degrees of freedom
3 lower arm
c3
middle arm
2 p0
c2
Upper arm
1
c1
base
c0 ( x, y, 0 )
f ( x, y,0 ,1,2 ,3 ) T ( x, y ) R(0 )T (0, l0 ) R(1 )T (l1,0) R(2 )T (l2 ,0) R(3 ) p0
Inverse Kinematics
• What if an animator specifies position of end-
effector?
θ2
l2
l1
End Effector
θ1 X=(x,y)
Base (0,0)
Inverse Kinematics
• Animator specifies the position of end-effector: x
• Computer finds joint angles: θ1θ2
θ2
l2
l1
End Effector
θ1 X=(x,y)
Base (0,0)
(θ1, θ2)=f-1(x)
Inverse Kinematics
• Animator specifies the position of end-effector: x
• Computer finds joint angles: θ1θ2
θ2
l2
l1
End Effector
θ1 X=(x,y)
Base (0,0)
Why Inverse Kinematics?
• Motion capture
• Basic tools in character animation
- key frame generation
- animation control
- interactive manipulation
• Computer vision (video-based mocap)
• Robotics
• Bioinfomatics (Protein Inverse Kinematics)
• Etc.
Inverse Kinematics
• Given end effector’s positions, compute
required joint angles
F(x)
x
Optimization As a Tool
• How to use optimization to solve the
following linear system?
3x + 2y = 5;
4x – 5y = 6
Optimization As a Tool
• How to use optimization to solve the
following linear system?
3x + 2y = 5;
4x – 5y = 6
Define a function:
F(x,y) = (3x+2y-5)2+(4x-5y-6)2
Optimization As a Tool
• How to use optimization to solve the
following linear system?
3x + 2y = 5;
Could be nonlinear equations!
4x – 5y = 6
Define a function:
F(x,y) = (3x+2y-5)2+(4x-5y-6)2
Define a function:
F(x,y) = f(x,y)2+g(x,y)2
arg min F ( )
θ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
i
|| f ( ) Ci || 2
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
if ( ) ci 2
f ( k ) ci
k 2
arg min i
i
Gauss-Newton Approach
Step 1: initialize the joint angles with 0
f ( k ) ci
k 2
arg min i
i
Known!
Gauss-Newton Approach
Step 1: initialize the joint angles with 0
f ( k ) ci
2
arg mink i
k Taylor series expansion
i
Gauss-Newton Approach
Step 1: initialize the joint angles with 0
f ( k ) ci
2
arg mink i
k Taylor series expansion
i
f
2
arg mink f i ( k ) ik k ci rearrange
i
Gauss-Newton Approach
Step 1: initialize the joint angles with 0
f ( k ) ci
2
arg mink i
k Taylor series expansion:
i linear approximation
f
2
arg mink f i ( k ) ik k ci rearrange
i
f ( k ) ci
2
arg mink i
k Taylor series expansion
i
f
2
arg mink f i ( k ) ik k ci rearrange
i
f
2
arg mink ik k (ci f i ( k ))
i
Linear equation!
Gauss-Newton Approach
• Optimizing an quadratic function is easy
f
2
arg min ik k (ci f i ( k ))
i
( J T J ) 1 J T b
Jacobian Matrix
• Jacobian maps the velocity in joint angle space to
velocities in Cartesian space
(x,y)
A small change of θ1 and θ2 results in how
much change of end-effector position (x,y)
θ2
θ1
f1 f1
x 1 2 1
y f 2 f1 2
1 2
Jacobian Matrix
• Jacobian maps the velocity in joint angle space to
velocities in Cartesian space
(x,y)
A small change of θ2 results in how much
change of end-effector position f=(x,y)
θ2
2 2 2
θ1
x x x
y y y
Jacobian Matrix: 2D-link Structure
θ2
l2
l1
θ1 C=(c1,c2)
Base (0,0)
θ1 C=(c1,c2)
Base (0,0)
f1 f2
Jacobian Matrix: 2D-link Structure
θ2
l2
l1
θ1 C=(c1,c2)
Base (0,0)
θ1 C=(c1,c2)
Base (0,0)
θ1 C=(c1,c2)
Base (0,0)
θ1 C=(c1,c2)
Base (0,0)
θ1 C=(c1,c2)
Base (0,0)
k 1 k k
arg min
if ( ) ci 2
• http://www.ics.forth.gr/~lourakis/levmar/
Another Example
• A 2D lamp character 3
c3
2 A
c2
1
c1
c0 ( x, y, 0 )
62
Another Example
• A 2D lamp character l3
l2 A
l1
l0
63
Forward Kinematics
• A 2D lamp character 3
c3
2 A
? c2
1
c1
c0 ( x, y, 0 )
Given ( x, y,0 ,1 , 2 ,,3 ) , how to compute the global position
of the point A? 64
Forward Kinematics
• A 2D lamp with 6 degrees of freedom
3 lower arm
c3
middle arm
2 p0
?
Upper arm
c2
1
c1
base
c0 ( x, y, 0 )
f ( x, y,0 ,1,2 ,3 ) T ( x, y ) R(0 )T (0, l0 ) R(1 )T (l1,0) R(2 )T (l2 ,0) R(3 ) p0
Inverse Kinematics
• A 2D lamp with 6 degrees of freedom
3 lower arm
c3
middle arm
2 p0
c0 ( x, y, 0 )
f ( x, y,0 ,1,2 ,3 ) T ( x, y ) R(0 )T (0, l0 ) R(1 )T (l1,0) R(2 )T (l2 ,0) R(3 ) p0
Inverse Kinematics
• A 2D lamp with 6 degrees of freedom
3 lower arm
c3
middle arm
2 p0
f ( x, y,0 ,1,2 ,3 ) T ( x, y ) R(0 )T (0, l0 ) R(1 )T (l1,0) R(2 )T (l2 ,0) R(3 ) p0
Human Characters
f T ( x0 , y0 , z0 ) R( 0 ) R(0 ) R( 0 )T10 R(1 ) R(1 ) R(1 )T21 R( 2 )T32 R( 3 ) R(3 ) x
68
Inverse Kinematics
• Analytical solution only works for a fairly
simple structure
• Additional objective
– Minimal Change from a reference pose θ0
Inverse Kinematics
• Generally ill-posed problem when the number of
Dofs is higher than the number of constraints
• Additional objective
– Minimal Change from a reference pose θ0
f i ( ) ci 0
2 2
arg min
i
Inverse Kinematics
• Generally ill-posed problem when the number of
Dofs is higher than the number of constraints
• Additional objective
– Minimal Change from a reference pose θ0
f i ( ) ci 0
2 2
arg min
i
• Additional objective
– Minimal Change from a reference pose θ0
– Naturalness g(θ) (particularly for human characters)
Inverse Kinematics
• Generally ill-posed problem when the number of
Dofs is higher than the number of constraints
• Additional objective
– Minimal Change from a reference pose θ0
– Naturalness g(θ) (particularly for human characters)
f i ( ) ci g ( )
2
arg min
i
Inverse Kinematics
• Generally ill-posed problem when the number of
Dofs is higher than the number of constraints
• Additional objective
– Minimal Change from a reference pose θ0
– Naturalness g(θ) (particularly for human characters)
f i ( ) ci g ( )
2
arg min
i