Stable Vehicle

Hi all,

I’m using the vehicle SDK to control a user driven car.
What I’m trying to achieve is a very smooth and stable driving style, what you normally experience in a highway at a medium-high constant speed.

The car is stable when not steering at all, but it’s difficult to obtain little direction changes like switching lane, even when steering by very small amount (using analog values from gamepad or wheel device).
After a small steer, you must keep to correct the direction left and right, it’s difficult to return straight and it’s easy to get a tailspin.

The main params I’ve touched to improve stability are (with respect to values provided in the examples)

  • higher vertical component of vehicle MOI
  • higher tire-to-surface friction, up to 1.5 (higher value make sense?)
  • toe angle (wheels converging towards each other)
  • smaller steer values in the gSteerVsForwardSpeedData

Have you guys any other hint?

And also, can I change some params after the vehicle has been setup (like the MOI, tire-to-surface friction) so to try to tweak them while my application is running?

Thank you,
ricky

Hi,

You can definitely change the moi. You will need to re-adjust the sprung masses of the suspension to account for the change.

You can also change the friction. The friction table is passed to PxVehicleUpdates. It makes no restrictions on historical values.

You can change almost any value at any time you like. The only restriction is that you don’t change values while vehicle raycasts or updates are running. The outcome is undefined because the values you set are used directly in the computation without any double buffering.

I’m not sure why your car is unstable. The first value I’d look at is the vehicle moi. Typically, I’ve computed the moi for a box with the vehicle’s dimensions and then tweaked the component around the up vector to make it easier or harder to turn.

Have you tried SampleVehicle? The car there seems reasonably stable. If your car is very different from the car in SampleVehicle then there may be some issues in the vehicle data. Hard to say what, though.

Thanks,

Gordon

Hi Gordon,

thanks for your reply.
Regarding your questions:

  • my car is very similar to that in the SampleVehicle, and I’ve copied basically all the car setup from the example
  • the car is not exactly unstable, simply as very slight steer at high speed causes the direction to change too much, is extremely hard to emulate and highway-like driving style
  • I’ll try to tweak the MOI+sprung masses, and friction again

There’s only one main difference with the sample vehicle I forgot to mention.
I had to use:
physx::PxVehicleSetUpdateMode(physx::PxVehicleUpdateMode::eACCELERATION);
instead of
physx::PxVehicleSetUpdateMode(physx::PxVehicleUpdateMode::eVELOCITY_CHANGE);

I have no idea why, but using eVELOCITY_CHANGE I get totally weird results like:

  • the car does not drop if I set its initial position above the road, it falls down extremely slowly
  • the car wheelies when accelerating and moves fwd sloooowly

I’m sure I have a correct gravity param set on the scene because if I drop other objects they fall down normally.
What am I missing?
Can this be a cause of the “instability”?

Thank you,
ricky

The update mode is a clue to something going wrong. They should give the same results to within numerical precision. The obvious thing to look at is the timestep passed to PxVehicleUpdates.

If you get too much steer at high speed you could try to alter the values in gSteerVsForwardSpeedData. Perhaps the car is getting a steer angle that is too large.

Which physx version are you using?

Gordon

Hi Gordon,

thanks for your reply.

The timestep I pass to the vehicle update is frame based ( running at 60Hz it’s quite regular around 0.167) and it’s the same when I use the 2 update modes.

On the PhysX sdk update on the other side I use a simple accumulator, to get a rigid fixed time step of 1/60.

I’ve already tweaked the gSteerVsForwardSpeedData by reducing the values in the second column, but no visible changes.

I’m on version 3.3.

Ricky

A little update:
I solved the issue I had with the 2 different update methods by reordering the update/simulate/fetch calls within my main loop.
I now have the 2 update modes working the same way.

The car though is still behaving like if it was on a slippery surface.

Hi again,

Did you manage to implement the telemetry graphs in your app? They might reveal some more information about the internal dynamics of the car. Possibilities could be that there is very little load on the tires, the wheels might be slipping too much, friction might not be what you expect it to be.

Gordon

Hi Gordon,

thanks for your suggestions.
I’ve managed to implement the telemetry graphs.
With a vehicle of mass 1500, center of mass slightly pushed towards the front, gravity at 9.8, I get roughly:

  • front wheels: load 5600, suspension 4700
  • rear wheels: load 3200, suspension 2600

What should I print to see if a wheel is slipping too much? Some Omega vs computer forward speed?

Thanks,
ricky