Constrained Dynamics The penalty method: use springs to enforce constraints does not satisfy constraints exactly leads to stiff equations
Constraint forces: directly calculate the forces required to maintain constraints: Cancel out any forces acting against the constraint.
Example: A bead on a wire Legal positions x must satisfy:
1 C ( x ) = ( x ⋅ x − 1) = 0 2 Legal velocities must satisfy:
C ( x ) = x ⋅ x = 0 Legal accelerations must satisfy:
C( x ) = x ⋅ x + x ⋅ x = 0 Start with a legal position and velocity, and make sure that the last equation is always satisfied.
Example: A bead on a wire A 2D particle constrained to move on the unit circle: Express constraint as a scalar behavior function: 1 C ( x ) = ( x ⋅ x − 1) = 0 2
Goal: compute a force to maintain the constraint.
Example: A bead on a wire Add a constraint force to ensure legal acceleration: x=
f + fˆ m
// fˆ is the (unkown) constraint force
Substitute: C(x ) = x ⋅ Therefore:
f + fˆ + x ⋅ x = 0 m
fˆ ⋅ x = −f ⋅ x − m x ⋅ x One equation, two unknowns!
Principle of Virtual Work In order to uniquely solve the previous equation another equation is needed Principle of virtual work: the constraint does not add (or remove) any energy to the total energy of the system. m The kinetic energy is T = x ⋅ x 2 Its time derivative is T = m x ⋅ x = m f ⋅ x + m fˆ ⋅ x This term should be zero
We got our extra equation !
General Case General framework:
C ( x ) = 0, C ( x ) = 0 Assume (x ) = 0 Find force that will satisfy C Use the principle of virtual work
How to deal with: Many particles ? Many constraints ?
Principle of Virtual Work For every legal velocity fˆ ⋅ x should vanish
fˆ ⋅ x = 0, ∀x | x ⋅ x = 0 Conclusion: fˆ must be in the direction of x: fˆ = λ x Substituting this term back, we get:
λ=
−f ⋅ x − m x ⋅ x x⋅x
(
)
Now we can compute fˆ = λ x and x = f + fˆ / m
Constrained Dynamics System Represent all particles as a 3n vector q Define a diagonal mass matrix M and its inverse W f is the vector of known forces fˆ is the vector of unknown constraint forces The global equation governing the system:
= Wf q
Constrained Dynamics System ∂C Legal velocity C = q = Jq = 0 ∂q
J is called the Jacobian of the system = Jq + Jq Legal acceleration C Substitute the forces: = Jq + JW(f + fˆ ) C
= 0 and rearranging: Requiring C
− JWf JWfˆ = − Jq
Principle of Virtual Work fˆ ⋅ q = 0, ∀q | Jq = 0
All and only vectors satisfying this can be expressed as: fˆ = J T λ − JWf Substituting fˆ we get: JWJ T λ = − Jq λ are known as Lagrange multipliers Using λ we can find fˆ and continue