# [ODE] Representing external simulation objects in ODE on a trajectory

dan miller danbmil99 at yahoo.com
Mon Jul 30 22:27:06 MST 2007

```the method that seems to work best is to create a simple proportional
controller to move an in-world object.  It can be as simple as this:

Say your object is presently moving at velocity V0, and you want it to move
at velocity V1.  set your force F = (V1-V0) * K, where K is a constant you
figure out by trial and error (look up theory on PID controllers if
interested).

This approach will work as long as there's friction around to damp potential
oscillations.  If not, you need to add a damping force, which would
typically be another constant times acceleration (ie difference between
present velocity and velocity at step t-1).

This sort of stuff is often in the game engine layers that are built on top
of physics engines.  There might be a game engine that sits on ODE that
would help with this; otherwise, it's roll-your-own.

-dbm

--- "Jon Watte (ODE)" <hplus-ode at mindcontrol.org> wrote:

> ODE is a penetration based solver, somewhat similar to penalty based
> methods. This means that, the deeper an object is embedded into another,
> the more force will be applied to the body to separate it. When you're
> moving a kinematic object (only a geom), then you run into the risk of
> making an object penetrate severely in a single time step, which might
> kick it using a very hard force. There is some help in setting ERP
> lower, or setting the "maximum allowed escape velocity" parameter -- but
> then, if the kinematic object moves quickly, the pushed object might not
> keep up.
>
> In general, resting contacts are hard, and resting contacts on moving
> bodies are even harder. If that's what you want to do, you might want to
> use a heavy body, and drive it with strong forces towards the desired
> location, rather than using a bodyless geom. Try both and see which one
> is better.
>
> Also, smaller time steps help, up to a limit. Time steps smaller than,
> say, 1 millisecond are likely to start introducing problems because of
> the small values involved (and the inverse of those values).
>
> Cheers,
>
> 			/ h+
>
>
> Devrim Erdem wrote:
> > Thanks Jon.
> >
> > Here is my concern at this point with the geometry:
> >
> > Imagine a rigid body box lying on a box geometry. The box slow starts to
>
> > move forward slowly. Would the friction between two boxes cause the box
> > above to move with the box below ?
> >
> > If this is a case which ODE can simulate nicely, is this generically
> > safe ? Would that work if the box below tilts or accelerates/decelerates
>
> > at higher amounts ?
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://ode.org/mailman/listinfo/ode
>

```