[ODE] Re: Inside ODE

nlin@nlin.net nlin at nlin.net
Mon Mar 11 18:22:01 2002


> I was wondering how ODE could achieve that level of robustness
> and stability (not to mention the pretty good accuracy of produced
> simulations !) without doing any time subdivision or performing any
> root-finding process in order to find the approximative time of impact
> of two interfering bodies.

See the example "A contact joint" in the recently posted document on
creating your own joints. http://q12.org/ode/joints.pdf

The rigid bodies in ODE are subject to "constraints", which are 
restrictions on the positions and velocities (the "configuration") of
the bodies in the system. Collision is treated as a constraint: a "contact"
constraint. When a collision is detected, the violation of the constraint
is described in terms of one or more penetrating points. The constraint
is enforced by requiring these penetrating points to have non-inward-directed
velocities.

It would be more accurate to enforce the constraint at the exact time of
impact by doing time subdivision as you mention. But with a constraint-based
approach, this isn't necessarily vital because the abstracted view of the
system deals with constraint enforcement at each timestep. Indeed, even starting
from an illegal configuration (interpenetrating bodies, separated joints),
ODE can (with the help of the stabilizing ERP) move the system back into
a legal state (this is sometimes called self-assembly).

With an impulse-based simulator (a la Mirtich), the collisions are the
defining factor in system evolution: evolve until the next collision, apply
impulse at exact collision time, repeat. With a constraint-based simulator like
ODE, a collision is just another constraint (just like sliders, ball/socket
joints, etc) which has certain velocity invariants which need to be maintained.
It is most accurate if the constraint is enforced at the exact instant it is
violated (i.e. at the exact instant of collision), but enforcing the
constraint a bit too late (even after some interpenetration) is not fatal.
This is also why, for instance, test_boxstack behaves gracefully even if
boxes are created in an initially interpenetrating state.

At least, that's how I understand it :-)

-Norman