Jon Watte (ODE) hplus-ode at mindcontrol.org
Fri Apr 13 21:34:06 MST 2007

What is chronos() ?

You should divide by the time step size. For example, if you pass 0.01
to dWorldStep() each time, that's what you should divide by to stop in
one step.

However, your problem is that you're using relative torque. The body
velocity is in global coordinates, so you should add global torque.

Cheers,

/ h+

Jacob Ole Juul Kolding wrote:
>
>
> On 4/13/07, *Jon Watte (ODE)* <hplus-ode at mindcontrol.org
> <mailto:hplus-ode at mindcontrol.org>> wrote:
>
>     In the analytic case, yes; you get the angular velocity, multiply by the
>     mass, and divide by the time step, negate it, and that's your necessary
>     torque.
>
>
> Ok, I have the following code:
>
>     if(fAngularDamp > 0){
>
>         if(!theEngine->chronos()){ // milisecs since last frame
>             return;
>         }
>
>         const dReal *curAVel = dBodyGetAngularVel(odeBody);
>         dVector3 dCurAVel;
>
>         dCurAVel[0] = curAVel[0] * odeMassf;
>         dCurAVel[1] = curAVel[1] * odeMassf;
>         dCurAVel[2] = curAVel[2] * odeMassf;
>
>         dCurAVel[0] = dCurAVel[0] / (theEngine->chronos() / 1000);
>         dCurAVel[1] = dCurAVel[1] / (theEngine->chronos() / 1000);
>         dCurAVel[2] = dCurAVel[2] / (theEngine->chronos() / 1000);
>
>         if((dCurAVel[0] != 0) || (dCurAVel[1] != 0) || (dCurAVel[2] != 0))
> -dCurAVel[1] * fAngularDamp, -dCurAVel[2] * fAngularDamp);
>     }
>
> The problem is that whenever fAngularDamp is above Zero, All rotation
> stops permanently and my shell is full of this:
>
> ODE Message 2: vector has zero size in dNormalize4() File odemath.cpp
> Line 129
>
> ODE Message 2: vector has zero size in dNormalize4() File odemath.cpp
> Line 129
>
> ODE Message 2: vector has zero size in dNormalize4() File odemath.cpp
> Line 129
>
> What am I doing wrong?
>
>     In the integrator case, there is always some behavior of the integrator
>     that may get in the way, but I haven't analyzed the ODE integrator
>     enough to correct for that -- I do what's outlined above, and it works
>     pretty well as-is.
>
>     Cheers,
>
>               / h+
>
>
>     Jacob Ole Juul Kolding wrote:
>      > Hello List
>      >
>      > I'm reading about resistance and angular damping in the FAQ but it
>      > didn't answer my question.
>      > I'm looking for at formula to determine the exact amount of torque
>      > required to put a rotating body to rest.
>      > The body in question having no contacts/joints attached nor being
>      > affected by gravity.
>      > Can this be computed from the angular velocity and mass of the body?
>      >
>      > Any help appreciated!
>      >
>      > /Jacob Kolding
>      >
>     ------------------------------------------------------------------------
>
>      >
>      > _______________________________________________
>      > ODE mailing list
>      > ODE at ode.org <mailto:ODE at ode.org>
>      > http://mooshika.org/mailman/listinfo/ode
>     <http://mooshika.org/mailman/listinfo/ode>
>
>