[ODE] movement force conversion

SJS ode at pulsecode.net
Tue Apr 12 05:30:21 MST 2005


Piotr has his formulas right from what I see--

new_ang_vel = (new_angle - old_angle) / delta_time
(radians/sec) = (radians - radians) / sec == radians/sec

This is assuming constant velocity over the time step (or we're using an
appropriate Euler integrator, anyway).

So if we have an initial velocity v[0] and we want a final velocity v[1]
such that we get to the new angle within this time step:
v[1] = 'new_ang_vel' from above
v[0] = body->get_angle_vel (); (as Piotr did)

assuming constant acceleration (or Euler integrator again),
v[1] = v[0] + aa[0]*dt -->  aa[0] = (v[1] - v[0])/delta_time

(there's the 2nd 'delta_time')
and units match--
(rad/sec) = (rad/sec) + (rad/sec^2)*sec == rad/sec

And just as F=m*a, T=I*aa (I := inertia tensor, and aa := angular
acceleration)

Your coordinate frame is important here-- including that of your inertia
tensor.  Since you're using ODE, all of these variables are probably in the
world frame, so you're OK.  If you're animating a hierarchical skeleton,
some of your animation will likely be local frames of the bones.  Just
remember (or look in to) coordinate frame transforms-- (R^-1)*M*(R) and
such.

Now whether his plan will work or not-- hehe, that's harder to answer.  The
above equations use the instantaneous angular velocity, assume lots of
things, and will only be perfectly reversible if the integrator in ODE is
the appropriate kind of euler integrator (backwards, forwards, whatever).  I
say 'whatever' because I don't care much (not because I'm a jerk, but)
because I'm pretty sure the results won't be nearly perfect enough anyway,
so you'll need something to compensate for accumulated errors from your
animation and/or collisions, joints, etc.

You COULD figure out which integrator is used and match everything
perfectly, but you'll end up with something that only works for an ideal
case with no perturbations-- basically about as stable as an inverted
pendulum (maybe only good for a single body with no collisions or joints).

Whew, long winded.  Anyway, summarizing, the delta_time in his equations are
right, but he'll need some serious tunable feedback to prevent his
animations from quickly straying from their intended orientations while
still allowing his character to interact via collisions and joints.

SJS


-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of Jon
Watte
Sent: Monday, April 11, 2005 1:55 PM
To: Piotr Obrzut; ode at q12.org
Subject: RE: Re[16]: [ODE] movement force conversion



> new_ang_vel = (new_angle - old_angle) / delta_time;

Don't divide desired velocity by delta-time, because your
desired velocity is not dependent on the time step size.
You can instead multiply by a response constant K, which
you can tune.

Also, this way of getting angular velocity will favor the
three cardinal axes, because it's a velocity "box" instead
of a single ("sphere"-morphic) vector.

> torque = Inertia * (new_ang_vel - old_ang_vel) / delta_time;

What's the value of Inertia? And if it's the inertia tensor,
what reference frame is it in?

Cheers,

			/ h+


_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode



More information about the ODE mailing list