Human Kinematics Kinematic representation Iterative methods - - PowerPoint PPT Presentation
Human Kinematics Kinematic representation Iterative methods - - PowerPoint PPT Presentation
Human Kinematics Kinematic representation Iterative methods Optimization methods Motion representation Maximal coordinates Generalized coordinates x, y, z, 0 , 0 , 0 ( x 0 , R 0 ) 1 , 1 ( x 1 , R 1 ) 2 ( x 2 , R 2
- Kinematic representation
- Iterative methods
- Optimization methods
Maximal coordinates
Motion representation
(x0, R0) (x1, R1) (x2, R2)
Assuming there are m links and n DOFs in the articulated body, how many constraints do we need to keep links connected correctly in maximal coordinates?
Generalized coordinates
θ1, φ1 θ2
state variables: 18 state variables: 9
x, y, z, θ0, φ0, ψ0
constraints: 9
Maximal coordinates
- Direct extension of well understood rigid body
dynamics; easy to understand and implement
- Operate in Cartesian space; hard to
- evaluate joint angles and velocities
- enforce joint limits
- apply internal joint torques
- Inaccuracy in numeric integration can cause body
parts to drift apart
Generalized coordinates
- Joint space is more intuitive when dealing with
complex multi-body structures
- Fewer DOFs and fewer constraints
- Hard to derive the equation of motion
Kinematics
- Forward kinematics
- given a joint configuration, what is the position
- f an end point on the structure?
- Inverse kinematics
- given the position for an end point on the
structure, what angles do the joints need be to achieve that end point?
Quiz
p θ φ
σ θ, φ, σ = f(p)
p θ φ
σ p = f(θ, φ, σ)
Which function is inverse kinematics?
Why inverse?
- More intuitive control
- Maintain environment constraints
- Calculate desired joint angles for control
Motion representation
Global position and orientation are determined by 3 translational and 3 rotational DOFs Each joint can have up to 3 DOFs
1 DOF: knee 2 DOF: wrist 3 DOF: arm
Configurations
θthigh, φthigh, σthigh θknee θankle, φankle
x, y, z, θ, φ, σ
q = x, y, z, θ, φ, σ, θth, φth, σth, θkn, · · ·
Transformation chain
h(q) p θthigh, φthigh, σthigh θknee θankle, φankle
h(q) = T(x, y, z)R(θ, φ, σ)T(d0)R(θth, φth, σth)T(d1)R(θkn)T(d2)R(θan, φan)x a point on foot in local coordinates a point on foot in world coordinates d1 d2 x, y, z, θ, φ, σ d0
Constraints
Position constraint
C(q) = h(q) − p = 0
h(q) p θthigh, φthigh, σthigh θknee θankle, φankle
h(q) = T(x, y, z)R(θ, φ, σ)T(d0)R(θth, φth, σth)T(d1)R(θkn)T(d2)R(θan, φan)x a point on foot in local coordinates a point on foot in world coordinates d1 d2 x, y, z, θ, φ, σ d0
Solutions
- Closed form solutions can only be found for fairly
simple mechanisms
- Numerical solutions
- No solution
- Single solution
- Multiple solution
Under-specified problem
- Multiple solutions
- Mostly bad
- How do we find the optimal solution?
- Heuristics (move the outermost links first)
- Closest to the current configuration
- Energy minimization
- Natural looking motion (whatever it means)
- Kinematic representation
- Iterative methods
- Optimization methods
Iterative method
- Use inverse of Jacobian to iteratively step all
the joint angles towards the goal
- Girard and Maciejewski, Computational
modeling for the computer animation of legged figures, SIGGRAPH 85
Problems
- Pseudo inverse returns the least square minimum
norm solution
- Singularities cause deficient Jacobian
- Linearization about current state causes error
- Kinematic representation
- Iterative methods
- Optimization methods
Optimization method
- Find a solution that optimizes some numeric
metric and satisfies constraints
- Numeric metric
- A function of q that measures the quantity
to be minimized
- Also called “objective function”
Optimization method
min
q G(q)
C(q) = 0
subject to Solve for joint configuration q
Objective functions
- Joint velocity
- Power consumption
- Similarity to the rest pose
- Similarity to the natural pose
Unconstrained optimization
- Treat each constraint as a separate metric and
minimize weighted sum of all metrics
- Also called penalty methods
- each spring pulls on constraint with force
proportional to violation of the constraint
Unconstrained optimization
F(q) = G(q) +
- i
wiCi(q)2
“Softening” constraints by adding them to the
- bjective function
Now we have a new optimization problem: min
q
Gradient descent
For each iteration, move in the direction of negative gradient And update the state
qnew = q − α∂F ∂q
−∂F ∂q = −∂G ∂q − 2 X
i
wi ∂Ci ∂q
T
Ci One of the simplest way to solve this optimization is gradient descent method
compute update while
F(q) > ✏ q = q − α∂F ∂q
Optimization loop
∂F ∂q = ∂G(q) ∂q + 2 X
i
wi(∂Ci ∂q )T Ci
Search step size
The step size in each search iteration can be determined arbitrarily, through a binary search, or solved by another optimization process Step size: where min
α F(q + α∆q)
α
qnew = q + α∆q
Optimize IK problem
We can simplify the problem by ignoring G(q), but we still need to know how to compute constraint derivatives. compute update while
F(q) > ✏ q = q − α∂F ∂q ∂F ∂q = ∂G(q) ∂q + 2 X
i
wi(∂Ci ∂q )T Ci
Constraint derivatives
- We need a direction to move
joints in such way that the handle moves towards the goal
- The derivative of the constraint,
i.e. Jacobian, gives directions where handles move if joints move
h(q) p
C(q) = h(q) − p = 0 ∂C(q) ∂q = ∂h(q) ∂q
Quiz
- What’s the dimension of the Jacobian for a
system with n dofs and m position constraints?
Constraint derivatives
∂C(q) ∂q = ∂h(q) ∂q
h(q) p
x, y, z, θ0, φ0, σ0 θ1
θ2, φ2 q = [x, y, z, θ0, φ0, σ0, θ1, θ2, φ2]
C(q) = h(q) − p = 0
Need to know how to compute derivatives for each transformation
∂h(q) ∂θ1 = T(x, y, z)R(θ0, φ0, σ0)T∂R(θ1) ∂θ1 TR(θ2, φ2)hk h(q) = T(x, y, z)R(θ0, φ0, σ0)TR(θ1)TR(θ2, φ2)hk hk: local coordinate of h
Quiz
- What is the derivative for the translation matrix?
- What is the derivative for a rotation matrix about
z axis?
1 3 1 5 1 −2 1 cos θ sin θ − sin θ cos θ 1 1
Constraint derivatives
h(q) p
x, y, z,
θ0, φ0, σ0
θ1
θ2, φ2
hk: local coordinate of h
What is the most efficient way to compute the ?
∂h(q) ∂q
h = T0(x, y, z)R0(θ0, φ0, σ0)T1R1(θ1)T2R2(θ2, φ2)hk
Compute the gradient for the DOF
- n the outermost link first
Unconstrained optimization
- Pros:
- simple and fast, no linear system to solve
- near-singular configurations is less of a problem
- Cons:
- can’t maintain constraints exactly
- constraints fight against each other and the
- bjective function
Constrained optimization
- Treat constraints as “hard constraints”
- Use Lagrangian formulation to solve a
nonlinear optimization
L(q, λ) = G(q) − λ · C min
q,λ L(q, λ)
Constrained method
- Pros
- Enforce constraints exactly
- Quadratic convergence
- Cons
- Large system of equations
- Near-singular configurations cause instability
Leg example
hip knee ankle R(q0)R(q1)R(q2) R(q3) R(q4)R(q5) L0 L1 L2 L3 T0h Th1 T1k Tk2 T2a Ta3 h0
Leg example
C(q) = T0hR0R1R2Th1T1kR3Tk2T2aR4R4Ta3h0 - p q0, q1, q2 q3 q4, q5 q = {q0, q1, q2, q3, q4, q5} p h0 To evaluate gradients of the obj function at each iteration, we need to evaluate constraint and compute Jacobian. How to compute J(q)?
node0 node1 node2 node3 hip knee ankle
Compute Jacobian
Consider the derivative of C with respect to q5
R(q0)R(q1)R(q2) R(q3) R(q4)R(q5) T0h Th1 T1k Tk2 T2a Ta3 h0 joint node
node->getParentBodyNode()->getTransform() joint->getTransformFromParentBodyNode() joint->getTransform(0) joint->getTransformDerivative(1)
∂C ∂q5 = T0hR(q0)R(q1)R(q2)Th1T1kR(q3)Tk2T2aR(q4) ∂R ∂q5 Ta3h0
joint->getTransformFromChildBodyNode().inverse()