[ODE] Weird Dynamics

Martin C. Martin martin at metahuman.org
Fri Mar 7 08:25:01 2003


That video's a lot of fun; thanks.

> I've created a rectangular arena consisting of four massive walls.

ODE wants all masses within about an order of magnitude of each other,
i.e. the largest mass shouldn't be more than about 10 times as big as the
smallest mass.  Since you don't want the walls to move, why not use planes
for the walls, i.e. geoms without bodies, like the ground plane in the
boxstack and buggy examples?


> At each time step a small force is
> applied in random direction to each sphere.

I expected the motion of the spheres to be "jiggly," like brownian
motion.  Instead, they seem to move in straight lines until they collide
with something.  Do you have any insight as to why they seem to move in
straight lines at constant speed?

> If two spheres collide, they
> stick to each other forever via a fixed joint.

This is a very error prone and inefficient way of doing this.  A group of
spheres has only six degrees of freedom for the entire group, but you're
asking ODE to simulate 6*n degrees of freedom, and then using constraints
to keep all those variables consistent.  Why not have a space associated
with each sphere, and when two spheres collide, add all the spheres in one
space to the space of the other?  That will save a lot of CPU time and
memory, and reduce the errors you're getting.

> What I observe when running the simulation is that aggregate articulated
> bodies indeed form. However, their behavior is really weird: they start
> rotating too fast, or gaining highly improbable impulses, or even
> exploding.

What are the CFM and ERP values for the joints you add?  And for the
collisions with the wall?  IF they're too stiff, that might cause the
behaviour you're seeing.

- Martin