How to increase vehicle grip ?

jams

10-09-2007 10:19:38

Hi,
now I can setup suspensions, I'd like to increase a lot my vehicle's grip. I've played a bit with longitudinal and lateral stiffness factor, but without significant success. I saw that we can define materials, but I'm not sure this is the right way ? And if so, which material paremeter to tweak ? And also, do I have to define a material for all shapes or only for wheels ?

luis

10-09-2007 14:46:43

I've played a bit with longitudinal and lateral stiffness factor

you have to set all parameters in the tire function, not just the stiffness since all of them are interdependent. Take a look at the parameters used in Ageia's demo...
I saw that we can define materials, but I'm not sure this is the right way ?
for the wheels use the tire functions ;)
do I have to define a material for all shapes or only for wheels ?
if you dont define a material, nxogre will create one for you (the default material) and set it to all shapes you create if you dont provide your own material.

perhaps your problem is that the default material, or the material used for the floor has not enough friction.... ?

jams

11-09-2007 00:07:11

I tried longitudinal and lateral values given in Ageia's sample, but it's not better. Though I've changed default material friction to a high value (5000) and it seems to get things better.
I wonder if my problem is not elsewhere, like giving too much torque to wheels ? I'm using the motor class, lightly modified like this in simulate method ://torque = ((mAcceleration * 7200.0f) * mGear[mCurrentGear] * mFinalGear) / (0.5f * 2000.0f);
// mRedline = 2500, instead of 7200 default value
torque = ((mAcceleration * mRedline) * mGear[mCurrentGear] * mFinalGear) / (0.5f * 2000.0f);

for(Wheels::Iterator i = Drive->items.begin();i != Drive->items.end();++i)
{
(*i)->setMotorTorque(torque);
(*i)->setBrakeTorque(mBrake);
}
By the way, does redline means maximum engine RPM ? Do you have any idea of the order of magnitude that torque should have ?
Sorry for all those questions, but I'm really stuck with this :(

luis

11-09-2007 08:39:26

Do you have any idea of the order of magnitude that torque should have ?
5000-6000 is what i'm using.

I think your problem is you are not setting the tire function or the default material (or both) in the proper way...
Could you post just the code where you do that ?

jams

11-09-2007 09:38:49

Here is the code for wheels creation :void Vehicle::setupWheels(int count, float radius, const std::string& mesh)
{
// Defines default suspensions settings
NxOgre::WheelParams wp;
wp.setToNormal();
wp.suspension_damper = 1000.f;
wp.suspension_spring = 2000.f;
wp.suspension_target = 0.05f;
wp.suspension_travel = 0.01f;

wp.longitudal_tire_asymptoteSlip = 2.0f;
wp.longitudal_tire_asymptoteValue = 0.01f;
wp.longitudal_tire_extremumSlip = 1.0f;
wp.longitudal_tire_extremumValue = 0.01f;
wp.longitudal_tire_stiffnessFactor = 1000000.0f;

wp.lateral_tire_asymptoteSlip = 2.0f;
wp.lateral_tire_asymptoteValue = 0.01f;
wp.lateral_tire_extremumSlip = 1.0f;
wp.lateral_tire_extremumValue = 0.01f;
wp.lateral_tire_stiffnessFactor = 1000000.0f;

// Temporary pointer on new wheel
NxOgre::Wheel* wheel = NULL;

// Get the vehicle extents
Ogre::AxisAlignedBox bbox = mBody->getEntity()->getBoundingBox();

// Start with front left wheel
Ogre::Vector3 wheelpos = bbox.getMaximum();
wheelpos.y = bbox.getMinimum().y+0.0f;
wheelpos.z -= radius;

NxOgre::ShapeParams sp;
sp.setToDefault();
sp.mLocalPose.id();

// Front left wheel
sp.mLocalPose.t = NxOgre::toNxVec3(wheelpos);
wheel = static_cast<NxOgre::Wheel*>(mBody->addShape(new NxOgre::WheelShape(radius, sp, wp)));
wheel->addMesh(mesh);
mWheels.insert(wheel);
// Front right wheel
wheelpos.x *= -1.f;
sp.mLocalPose.t = NxOgre::toNxVec3(wheelpos);
wheel = static_cast<NxOgre::Wheel*>(mBody->addShape(new NxOgre::WheelShape(radius, sp, wp)));
wheel->addMesh(mesh);
mWheels.insert(wheel);
// Back right wheel
wheelpos.z *= -1.f;
sp.mLocalPose.t = NxOgre::toNxVec3(wheelpos);
wheel = static_cast<NxOgre::Wheel*>(mBody->addShape(new NxOgre::WheelShape(radius, sp, wp)));
wheel->addMesh(mesh);
mWheels.insert(wheel);
// Back right left
wheelpos.x *= -1.f;
sp.mLocalPose.t = NxOgre::toNxVec3(wheelpos);
wheel = static_cast<NxOgre::Wheel*>(mBody->addShape(new NxOgre::WheelShape(radius, sp, wp)));
wheel->addMesh(mesh);
mWheels.insert(wheel);
}
This is with tire functions from Ageia sample.
And here is how I setup materials to high friction value:NxOgre::MaterialList* list = mScene->getMaterials();
NxOgre::Material* mat = list->begin();
while(!list->end())
{
mat = list->next();
mat->setDynamicFriction(500.f);
mat->setDynamicFrictionV(500.f);
mat->setStaticFriction(500.f);
mat->setStaticFrictionV(500.f);
mat->setRestitution(0.0f);
}

luis

11-09-2007 13:32:38

After all your wheel setup try: (do it for for each wheel!)


wheel->getNxWheelShape()->setLateralTireForceFunction(...);
wheel->getNxWheelShape()->setLongitudalTireForceFunction(...);


and set the dynamic/static friction usual values like 0.5 for dynamic, 1.0 for static....

jams

12-09-2007 15:18:19

Thanks to your help I can now setup my car almost well. There's still something I can't figure out. The vehicle bounce too much, either on the ground or against other bodies. My scene has only one material, with restitution sets to zero. And I do not assign material to my shapes. It does not come from suspensions, because even on the roof, the vehicle still bounce ... bounce ...
Well, I just look at your teaser of 'ThunderWheels' and I hope I will get tenth of its realism ;)

luis

13-09-2007 08:22:54

i'm glad you liked TW's teaser ;)

did you set the friction in default material to 0.5/1.0 ? having a *crazy* value like 500 could be reason to have a wrong simulation....

jams

13-09-2007 09:42:44

Yes I did, now I use reasonable values like you suggest (0.5 and 1.0). Is there any force automatically applied when the vehicle isn't lying on its wheels, to put it right on the ground ?

luis

13-09-2007 10:13:01

you mean something like anti-sway bars ?

i did something like that in OgreOde (i adapted the code on the ODE wiki)... but I didnt need it in NxOgre, try lowering the mass center in the chassis body.

jams

13-09-2007 13:21:05

I think I don't need anti-sway, beacuse suspensions are really stiff. The mass center is already at the bottom of the body (I guess I can make it outside, but that would be a little bit extreme ...). I was wondering if the excessive bounce effect could be due to a ground shape that could add to the floor response (the scene has a floor enabled) ? I tried without the floor, but then the wheels seem to pass a bit through the ground shape, keeping the vehicle stuck. And when I keep only the floor I have similar result :(.

luis

13-09-2007 16:20:21

I re-read you post and saw something strange in the suspension parameters... take in count that this:
wp.suspension_travel = 0.01f;
means almost *no* suspension (1milimeter).... if you cant change it try setting the damper/sping to 1.0 or similiar...

jams

13-09-2007 19:57:37

Well, I've tried something drastic, I removed motor and wheels from the vehicle. Yes, now it's just a body with a cube shape. And what's weird, is that it still bounce on the ground ! Though I have a big box and a big sphere, 3000kg each, falling on the ground with no bounce effect ! I may have left something wrong, I'll see it tomorrow !

Smaller values for damper and springs work a bit better, thanks.

jams

14-09-2007 10:31:09

I've double check with Physx remote debugger, and see that actually the big box and big sphere had a mass of only 10 (which is the default value I guess). When do give them a mass of 3000, the box keep bouncing like my vehicle's body (that sound more logic this time) and the sphere does not bounce at all. That seems to be related to either inertia tensor or angular momentum. So I tried to increase angular damping, and it does reduce a lot bouncing, but allow the box to stay on an unstable position (on the edge).