[ODE] Re: Jitters
Matthew D. Hancher
mdh at email.arc.nasa.gov
Tue Nov 9 16:00:09 MST 2004
Tyler Streeter <tylerstreeter at gmail.com> wrote:
> Should the damping also be scaled by the simulation step size in this
> case? It seems important to factor in the step size if you're scaling
> the velocity directly, but what about the cases where you're adding an
> opposing force/torque proportional to eithe velocity or momentum?
No, if you are applying forces proportional to the momenta you don't
want to scale them by the time step size.
When you damp by adjusting velocities, you're implementing the equation
dv/dt=-k*v with some damping constant k. The change in velocity (dv) at
each time step is therefore -k*v*dt, which scales with the time step
size (dt). When you're damping by applying forces, on the other hand,
you're implementing the same equation but with the momentum (p) replacing
the velocity: dp/dt=-k*p. Note that F=dp/dt and p=m*v (basically by
definition) so this reduces to F=-k*m*v. The dependence on the time step
size is gone, but the dependence on mass has appeared. The reasoning is
basically identical for angular damping.
In practice you may actually want to *reduce* the damping for large time
steps, for stability reasons, but that's another matter entirely.
> Just to clarify what the actual code from standard ODE would be... I
> think the mass.I inertia matrix is relative to the body, so you'd
> either have to convert this to a global frame or convert the angular
> velocity and resulting torque to the body's frame of reference. Does
> that sound right to everyone else?
>
> Btw, what's the easiest way to get a body's angular velocity locally,
> not globally?
Ah yes, sorry. I think dBodyVectorFromWorld() and it's cousin
dBodyVectorToWorld() are probably the best tools for the job?
Matt Hancher
NASA Ames Research Center
mdh at email.arc.nasa.gov
More information about the ODE
mailing list