Learning outcomes
- Derive velocity and acceleration constraints.
- Solve a multiplier system with consistent signs.
- Explain drift and Baumgarte stabilization.
Prerequisites: Linear algebra, ODEs, and earlier lectures in this sequence.
Constraint levels
A holonomic constraint is ϕ(q)=0. For simple Euclidean coordinates, differentiating gives Jv=0 and Ja+J˙v=0, where J=∂ϕ/∂q. A constrained mechanical system satisfies
Ma=τ−c+J⊤f.
The multiplier f enforces the acceleration constraint. Using this plus-sign force convention gives
[MJ−J⊤0][af]=[τ−c−J˙v].
Changing the definition of multiplier sign changes the off-diagonal block. Keep the equations and implementation together.
Worked particle on a circle
Let ϕ(p)=21(p⊤p−ℓ2), so J=p⊤ and J˙v=v⊤v. At p=(1,0), v=(0,2), ℓ=1, and no external force, the constraint requires p⊤a=−4. A unit mass therefore has centripetal acceleration a=(−4,0).
A velocity can be tangent while the acceleration has a radial component. Setting radial acceleration to zero would immediately leave the circle.
Constraint drift
An acceleration-level solve does not by itself eliminate discrete position and velocity errors. Even if Ja+J˙v=0 holds at each computed state, numerical integration can accumulate ϕ=0.
Baumgarte stabilization replaces the target with
Ja+J˙v=−2αJv−β2ϕ.
The ideal constraint error then obeys ϕ¨+2αϕ˙+β2ϕ=0. Large gains may make the numerical problem stiff. Projection methods are another approach, but projection changes momentum or energy unless designed carefully.
Practice
Practice 5 simulates the circle-constrained particle under gravity with and without stabilization. It reports maximum position-constraint error and the acceleration residual. Compare several timesteps before choosing gains.
Use consistent initial conditions: the position must satisfy ϕ=0 and the velocity must satisfy Jv=0. Starting off the manifold tests recovery, a different question from drift under consistent initialization.
Exercise and answer guide
If the same constraint row is duplicated, can you still invert JM−1J⊤? Answer: generally no; the rows are dependent. Acceleration can remain well-defined while multipliers are nonunique. Use a rank-aware solve or remove redundant constraints, and inspect residuals rather than assuming a successful solve.
The next lecture interprets the acceleration correction as a minimum-change principle, then explains why MuJoCo's soft constraints should not be identified with this exact rigid equality solve MIT multibody dynamics.