[ODE] Car either keeps bouncing or sinks into the ground

Joost van Dongen tsgoo at hotmail.com
Thu Aug 12 16:13:14 MST 2004


I am trying to get a little car to drive on a box, but somehow I cannot get 
the settings to work. What happens is that the little car keeps bouncing on 
the surface or, if I set the ContactMaxCorrectingVel, the car sinks into the 
surface of my box. You can see for yourself in the following compiled 
program:

http://student-kmt.hku.nl/~joost1/LittleCarTest.zip (3,6mb and uses Ogre for 
rendering, which is included)

The boxes used as wheels in the example are just the 3d-models for the 
renderer, the ODE-geom for the wheels are of course spheres.

These settings I currently have for the world:

dWorldSetGravity(odeWorldID, 0, 0, -0.2);
dWorldSetContactMaxCorrectingVel(odeWorldID, 2);
dWorldSetERP(odeWorldID, 0.2);
dWorldSetContactSurfaceLayer(odeWorldID, 0.001);

I have experimented with all of these values and with the CFM as well, but I 
could not get it to work well.

The following settings I currently have for the contact generation:

contact[i].surface.mode = dContactSlip1 | dContactSlip2 | dContactSoftERP | 
dContactSoftCFM | dContactApprox1;
contact[i].surface.mu = dInfinity;
contact[i].surface.slip1 = 0.1;
contact[i].surface.slip2 = 0.1;
contact[i].surface.soft_erp = 0.5;
contact[i].surface.soft_cfm = 0.3;

These are copied from example-files, but I have experimented with other 
settings as well and did not get it right.

What am I doing wrong? Can somebody please help me?



-----



Just in case the fault is not in the above settings but in something else: 
some more parts of my code. An example of how a joint is created:

leftJoint = dJointCreateHinge2(world, NULL);
dJointAttach(leftJoint, bodyPhysics->getOdeBodyID(), 
wheelLeftPhysics->getOdeBodyID());
dJointSetHinge2Anchor(leftJoint, -1.8, 0, -4);
dJointSetHinge2Axis1(leftJoint, 0, 1, 0);
dJointSetHinge2Axis2(leftJoint, 0, 0, 1);
dJointSetHinge2Param(leftJoint, dParamLoStop, 0);
dJointSetHinge2Param(leftJoint, dParamHiStop, 0);
dJointSetHinge2Param(leftJoint, dParamVel2, 2);
dJointSetHinge2Param(leftJoint, dParamFMax2, 1);
dJointSetHinge2Param (leftJoint, dParamSuspensionERP, 0.4);
dJointSetHinge2Param (leftJoint, dParamSuspensionCFM, 0.8);

And one of how a wheel is created:

wheelLeft = ncg::Environment::getInstance().getRootNode()->createChild();
new ncg::Object3D("CarWheel.mesh", wheelLeft);
wheelLeft->setScale(Ogre::Vector3(0.02, 0.02, 0.02));
ncg::ObjectPhysics* wheelLeftPhysics = new ncg::ObjectPhysics();
wheelLeft->setBehaviour(wheelLeftPhysics);
wheelLeftPhysics->addOdeGeomID(dCreateSphere(NULL, 1));
dMass* leftMass = new dMass;
dMassSetSphere(leftMass, 1, 1);
wheelLeftPhysics->setMass(leftMass);
wheelLeftPhysics->setPosition(Ogre::Vector3(-1.8, 0, -4));

As can be seen, there is some 'strange' code as a wrapper has been written 
to combine physics and rendering, but the error does not seem to be in the 
wrapper itself.

_________________________________________________________________
Hotmail en Messenger on the move 
http://www.msn.nl/communicatie/smsdiensten/hotmailsmsv2/



More information about the ODE mailing list