skeletal motion, inverse kinematics
DESCRIPTION
Skeletal Motion, Inverse Kinematics. Ladislav Kavan [email protected] http://isg.cs.tcd.ie/kavanl/IET. Animating Skeleton. Character animation decomposed to skinning (skin deformation) previous lesson animation of the skeleton this lesson We consider only rotational joints - PowerPoint PPT PresentationTRANSCRIPT
Ladislav Kavan 2
Animating SkeletonCharacter animation decomposed to skinning (skin deformation)
previous lesson animation of the skeleton
this lesson
We consider only rotational joints n ... the number of joints joint rotations described by matrices T(0), ..., T(n)
The task: Acquire T(0), ..., T(n) for each frame of the animation
Ladislav Kavan 3
Summary of Animation Methods direct control of rotations (forward kinematics)
tedious work - only key postures designed others computed automatically
indirect control: inverse kinematics specify a goal, rotations computed automatically more intuitive to use
motion capture records a real motion difficult to control (but possible!)
forward dynamics physics engines
Ladislav Kavan 4
Keyframe Animationvery old concept (Disney's studios)Idea: specify only important (key) frames others given by interpolation of key frames
Anything can be controlled via keyframes (not only rotation of joints)
variety of interpolation curves piecewise constant, linear, polynomial (spline)
For rotation: good interpolation of rotations essential! SLERP (recall quaternions) SQUAD (Spherical QUADratic interpolation)
Ladislav Kavan 5
Forward Kinematics (FK) used for keyframe design
originated in robotics
kinematic chain: a chain (path) of joints base: the fixed part of a kinematic chain end-effector: the moving part of a kinematic chain
Assume (wlog): each joint rotates only about one fixed axis (... only 1-DOF)
Replace the 3-DOF joints by three 1-DOF joints (with the same origin)
Ladislav Kavan 6
Forward Kinematics (FK)Input: state vector = (1, ..., k)T - joint rotations k is the number of DOFs of the kinematic chain
Task: compute position (and orientation) of the end-effector: x = f()
only position: 3-DOF end-effector, xR3
position and orientation: 6-DOF, xR6
first three coordinates: translation second three coordinates: rotation in scaled axis
representation (unit axis multiplied by angle of rotation)
Solution: f is concatenation of transformations computed in the part about skinning: matrix F
Ladislav Kavan 7
Inverse Kinematics (IK)Input: the end-effector (goal) x is given
typically 3 to 6-DOFs
Task: compute state vector = (1, ..., k)T such that f() = x, i.e. = f-1(x)
Problems: sometimes no solution (example?) solution may not be defined uniquely (example?)
infinite number of solutions (example?) f is non-linear
because of the sin and cos in rotations
Ladislav Kavan 8
IK: Analytical SolutionIdea: solve the system of equations f() = x for very difficult for longer kinematic chains used only for 6/7-DOF manipulators usually the fastest method (if possible)
Example: Human Arm Like (HAL) chain 7 DOFs: 3 shoulder, 1 elbow, 3 wrist fast analytic solution for given position and
orientation - IKAN library 1 DOF remains: parametric solution
the parameter is a "swivel angle"
Ladislav Kavan 9
IK: Non-linear OptimizationIdea: minimize function E() = f() - x solved by non-linear optimization (programming)
Advantages easy to incorporate joint limits
add conditions li i hi, where li and hi are the limits
allows more general goals (planar, half-space, ...)
Disadvantages non-linear optimization can give a local minimum
(instead of the global one) slow for real-time applications
Ladislav Kavan 10
IK: Numerical SolutionsSolve the problem for velocities (small displacements) local approximation of f by linear function - called
Jacobian
k
d
2
d
1
d
k
2
2
2
1
2
k
1
2
1
1
1
k1
fff
fff
fff
JJf
J
k ... number of joints (DOFs)d ... dimension of goal (end-effector, usually 3-6)
Ladislav Kavan 11
IK: Jacobian MethodsTypically: d=6 and f = (Px, Py, Pz, Ox, Oy, Oz)
(Px, Py, Pz) ... position
(Ox, Oy, Oz) ... scaled rotation axis
Then Ji, the i-th column of Jacobian is computed asTT
T
T
i
z
i
y
i
x
i
z
i
y
i
xi
)(O,
O,
O,
P,
P,
PJ
i
ii
ω
rω
where i is the axis or rotation of the i-th joint
ri is the end-effector vector w.r.t. the i-th joint
Ladislav Kavan 12
IK: Jacobian InversionOriginal equation: x = f()Using Jacobian: x = J()
Jacobian maps small changes to small x changes
Assume the Jacobian can be inverted: = J()-1xIK algorithm
Input: current posture , goal xg, current end-effector position xc
Repeat until xc close to xg:
1. x = k(xg - xc) // k ... small constant
2. compute J()-1
3. = + J()-1 x4. xc = f()
Ladislav Kavan 13
IK: Jacobian InversionProblems with inversion of J():1. J() rectangular (square only if k=d)2. J() singular (rank-defficient)
Ad 1) (Moore-Penrose) pseudo-inversion compute from Singular Value Decomposition (SVD)
Ad 2) serious problem: configuration singular Example: fully outstretched kinematic chain near singularity: large velocities & oscilation SVD detects singularity
Ladislav Kavan 14
Singular Value Decomposition (SVD)Theorem: Any real mn matrix M can be written out
as M = UDVT, where U ... mn with orthonormal columns D ... nn diagonal (singular values) V ... mm orthonormal
Properties: M regular iff D contains no zeroes if Di is D with non-zero elements inverted, then
UDiVT is the pseudo-inverse matrix efficient and robust algorithms for SVD exist
implemented for example in LAPACK
Ladislav Kavan 15
IK: Jacobian TransposeIdea: force acts on the end-effector and pushes it to the
goal configuration
Principle of virtual work: work = force distance, work = torque angle
FTx =T (work = work)x = J() (Jacobian approximation)
FT J() =T (putting together) FT J()=T
= J()TF (transposing)
Ladislav Kavan 16
IK: Jacobian TransposeInstead of = J()-1xuse simply = J()Tx
interpret as , and F as x
The algorithm: the same as Jacobian Inverse, just use transpose instead of inversion
Comparison with the Jacobian Inverse: (pseudo-)inversion more accurate - less iterations transposition faster to compute transposition: physically based
intuitive control (rubber band)
Ladislav Kavan 17
IK: Cyclic Coordinate Descent (CCD)Idea: change only one joint angle i per step others constant: analytical solution possibleInput: Pc - current end-effector position
Pg - goal end-effector position
(u1c, u2c, u3c) - orthonormal matrix: curr. orientation
(u1g, u2g, u3g) - orthonormal matrix: goal orientation
Objective: minimize
3
1j
2
g
2
g 1,)(E jcjc uuPP
Ladislav Kavan 18
IK: CyIn the i-th step: 1, ..., i-1, i+1..., k constant
Minimize E() = E(1, ..., k) only w.r.t. i
Pic - current end-effector position w.r.t. joint i
Pig - goal end-effector position w.r.t. joint i
Pic'(i) - Pic rotated about joint i's axis with angle i
Minimization of w.r.t. i equivalent to
Maximization of g1(i) =
IK: Cyclic Coordinate Descent (CCD)
2
g cPP
)(', iicig PP
Ladislav Kavan 19
(u1c'(i), u2c'(i), u3c'(i))
orthonormal matrix of the current orientation rotated by angle i about the i-th joint's axis
Minimization of w.r.t. i equiv. to
Maximization of
Position and rotation together: g(i) = wpg1(i) + wog2(i)
wp resp. wo is weight of position resp. orientation goal
IK: Cyclic Coordinate Descent (CCD)
23
1jg 1,
jcj uu
3
1jigi2 )(',)(g jcj uu
Ladislav Kavan 20
The function g(i) can be maximized analytically
(complicated formulas, but fast to evaluate)
CCD Algorithm:i = 1;Repeat until E() close to zero:1. compute i giving maximal g(i)
2. i = (i % k) + 1
CCD has no problems with singularities converges well in practice
IK: Cyclic Coordinate Descent (CCD)
Ladislav Kavan 21
IK: Modern TrendsCharacter animation: joint limits importantFirst idea: impose limits on individual DOFs (angles) too simple to express real joint range
Advanced joint limits quaternion field boundaries:
human motion recorded using motion-capture rotations of joint (shoulder) converted to quaternions boundaries expressed on unit quaternion sphere