[ODE] Slip & FDir

William Liebenberg wizzy at datafast.net.au
Tue Sep 2 15:07:02 2003


Hi Guys

Like many other people I've been working on a Car Simulation using ODE. The
message archive has had some great solutions for me so far.

Im using a typical setup of a box for the chassis, box for the engine
attached with a fixed joint to the chassis (just to slightly lower the
center of mass), 4 spheres for the wheels using hinge2 joints.

I set the flags and values for slip1, slip2 of the contact surface, plus I
set the FDir vector to the current X-Axis of the wheels rotation matrix (X =
left/right, Y = Up/down, Z=forward/backward). I also set the mu and mu2
values.
 
The problem I have is that if I increase slip2, then the wheels lose forward
traction (ie. They spin more, and the vehicle doesn't accelerate as fast as
before). But, if I lower slip2 to avoid the loss in traction, then the car
accelerates better, but rolls/tips over when I go around bends at medium to
high speeds.

Ive been tweaking the values (mu,mu2,slip1,slip2) for nearly a week on and
off and cant seem to find a proper combination.

Can someone maybe shed some light on this for me please?

Thanks.

PS. Here is the code I use to set the contact properties for the wheels:

    virtual void setSurfaceParams(dContact& cont)
    {
        cont.surface.mode = 0;        
        cont.surface.mode |= dContactFDir1;
        cont.surface.mode |= dContactMu2;
        cont.surface.mode |= dContactApprox1;
        cont.surface.mode |= dContactSoftCFM;
        cont.surface.mode |= dContactSoftERP;
        cont.surface.mode |= dContactSlip1;
        cont.surface.mode |= dContactSlip2;
                
        cont.surface.mu = friction; // forward
        cont.surface.mu2 = friction2; // sideward

        cont.surface.soft_cfm = 0.0001;
        cont.surface.soft_erp = 1.00;
        
        cont.surface.slip1 = slip1 *
this->physicsObj->getAngularVelocity().length(); // forward        
        cont.surface.slip2 = slip2 *
this->physicsObj->getAngularVelocity().length(); // sideways        

        Matrix4 wheelOr = this->physicsObj->getRotation();
        Vector3 wheelDir = Vector3(wheelOr._11,wheelOr._12,wheelOr._13);

        wheelDir.normalize();

        cont.fdir1[0] = wheelDir.x;
        cont.fdir1[1] = wheelDir.y;
        cont.fdir1[2] = wheelDir.z;    
    }