[ODE] Jitters

Tim Rightnour root at garbled.net
Mon Nov 8 16:15:39 MST 2004


On 08-Nov-2004 Jon Watte wrote:
> Ouch! The problem is that dBodyGetXxxx returns pointers 
> into the actual data used by ODE. You're slamming the actual 
> velocity values kept in the bodies when you do the *= !
> Just stepping into this with the debugger would probably have 
> shown you this, assuming you're building ODE from source 
> (which you should be doing).
> 
> Instead, you can change your code to:
> 
>   dBodyAddForce( body, v[0]*-0.01, v[1]*-0.01, v[2]*-0.01 );
> 
> Same for torque.

So I changed it to:

void apply_damping(dBodyID body) {
    const dReal *v = dBodyGetLinearVel(body);
    const dReal *x = dBodyGetAngularVel(body);

    dBodyAddForce(body, v[0]*-0.01, v[1]*-0.01, v[2]*-0.01);
    dBodyAddTorque(body, x[0]*-0.01, x[1]*-0.01, x[2]*-0.01);
}

And the exact same problem occurs.  Body instantly shoots off into oblivion.

OLD sword: pos 1200.00 449.90 1300.00 rot: -0.00 90.00 0.00
NEW sword: pos 1200.00 454.62 1300.00 rot: -0.00 90.00 0.00
step
OLD sword: pos 1200.00 454.62 1300.00 rot: -0.00 90.00 0.00
NEW sword: pos 1200.00 222.80 1300.00 rot: -0.00 90.00 0.00
step
OLD sword: pos 1200.00 222.80 1300.00 rot: -0.00 90.00 0.00
NEW sword: pos 1200.00 11611.92 1300.00 rot: -0.00 90.00 0.00
step
OLD sword: pos 1200.00 11611.92 1300.00 rot: -0.00 90.00 0.00
NEW sword: pos 1200.00 -547925.38 1300.00 rot: -0.00 90.00 0.00

Groundheight is about 390 at this location.  Without the damping, the object
settles, but jitters forever.  Dropping the stepsize from 0.05 to 0.01 didn't
help, the object will still jitter for hours.

---
Tim Rightnour <root at garbled.net>
NetBSD: Free multi-architecture OS http://www.netbsd.org/
NetBSD supported hardware database: http://mail-index.netbsd.org/cgi-bin/hw.cgi


More information about the ODE mailing list