[ODE] ODE with non-penetration constraint

Dirk Gregorius dirk at dirkgregorius.de
Thu Jul 12 12:49:15 MST 2007

```A hard constraint basically means that you have a "hard" algebraic
constraint equation instead of plugging in a "soft" spring like in a
penalty method. The ODE requires for each contact:

1) The penetration at the contact should vanish
C(p,q) = (p1 + r1 - p2 - r2) * n - d = 0

2) The relative velocity should vanish
dC/dt  = (v1 + cross( omega1, r1) - v2 - cross(omega2, r2) * n

-> J = ( n,  cross( r1, n ), -n, -cross( r2, n ) )

Since we apply only forces when we have an approaching relative velocity
at the contact we basically end up with

w = A*x + b >= 0 and x >= 0 and xT * w = 0 which is a classic LCP or
MLCP in presents of additonal holonome constraints.

Actually each position constraint imposes also a velocity- and
acceleration constraint onto the system. Think of a ball socket joint.
The position constraint requires that the anchors are at the same point
in space. In order to maintain this constraint the relative velocity and
acceleration must vanish at the anchor. Otherwise the anchors would get
apart. So *all* constraints (position, velocity and acceleration) must
always be satisfied. The ODE solves only at the velocity level. Note
that even when you fully satisfied the velocity constraints, you still
can end up with violated position constraints (e.g. because of high
angular velocities). The ODE deals with this using Baumgarte