How to make a stable car physics?

Started by
23 comments, last by bmarci 10 years, 2 months ago


This is strange, because when I go from a fixed timestep of 0.02 to 0.002, a 500hz simulation (1/0.002) I get a pretty bouncy suspension with 50k springs.

I think I might know what your problem could be.

Do you use any physics middleware??

If so, we have a catch 22 situation here :)

Physics engines, like Bullet, Havok, Newton, whaterever, updates at 60Hz.

If you crank up your simulation speed to let's say 300Hz, it means the the car dynamics is updated 5times more frequently than the rigid body physics itself.

Let's see an example:

1. step, the suspension and tire generate 2000N force that pushes the chassis upwards. You call, PhysicsEngine->body->ApplyForceAtPosition()..

2. step, The rigid body is not updated because it's time has not came yet, so you update the car again, 2000N force added to the rigid body again...

.

.

.

5. step, the car update has ran 5 times added 10000N force to the body so far

6. step, The physics engine gets updated and all the accumulated forces act on the car's body. Probable 5times more that actually needed.

Either you can divide the calculated forces upon the ratio of "physics:dynamics". So AppliedForce=TotalForce*60/300;

The problem with that is if your car's body is updated at only 60Hz, and your calculations depend on the car's body, you don't gain anything with using smaller timesteps, but 50Hz is clearly not enough for a 50KN/m suspension.

Advertisement


Do you use any physics middleware??

Indeed I am using PhysX and I can change the physics timestep. wich is the speed. So t his is not the problem, its just heavyer on the CPU with smaller timesteps (0.002 is 500hz).
But the simulation actually seems stable at 50hz with stiff suspension. But with softer suspension it gets quite hard to drive. Visually it looks better, but handling is awfull. Maybe its the slip combination...


Visually it looks better, but handling is awfull. Maybe its the slip combination...

You can try increasing the lateral grip for the rear wheels. The a2 coeff in pacejka. Sport/race cars have wider tires at rear anyway :)

No too much help, but maybe...

Figured out that I was decresing the load with positive gravity while applying mass, fliped the sign and loads got much better, so did the handling, but now I'm back to low speed friction, since it seems like slip angles are now jumping from ~50 deg to -50 deg. Probably becuse the velocityes are to small for longitudinal and lateral sides. Need a way to damp them down and this seems to be the hardest topic in vechicle simulation. I can do the sim at 1000hz and with SAE method, but there stil lseems to be some jerking wich I dont like. I have seen in games that a car can come to a complete stop with a simulation thats running at 50hz, this is what Im trying to achieve now. Because I noticed that my driveline works also better in 50hz, with 1000hz I get some nasty angular velocity flicks when the car is powerfull (lets say 700nm at peak engine rpm) Its causing the clutch to disengage and do some funny things. Maybe I need to design a new clutch instead... but anyways I got the handling fixed I guess and with cars like 300nm the simulation ins quite stable at 1000hz :)

with 1000hz I get some nasty angular velocity flicks when the car is powerfull (lets say 700nm at peak engine rpm) Its causing the clutch to disengage and do some funny things

yes this flickering is also present in mine. I suspect, it's because the tire slip ratio flickers, those huge reaction torques go back to the engine. I still have issues with the driveline especially with powerful engine ~400Nm.
But meanwhile I managed to improve my tire, and it's now much better over rumblestrips and bumps.
Here are some experiences;
Now I handle the wheel as a separate object (only logical means) and apply separate forces to that. Also I use an other spring representing the rubber. So that spring force is pushing the wheel hub upwards and the gravity and the suspension is pushing it downwards. This generates the movement of the wheel hub as well the suspension spring's. The fx and fy forces are applied at the contact patch and the suspension spring force is at the attach position.
The fy should be applied at various places, though to have proper lateral jacking, but for now this is still satisfying.
An other thing that proven to be important was the tire damping. Some articles mention 500N/m/s, but i'd go for 5000. Maybe I'm overcomplicating it but using variable damping produced the best result. That means, the damping changes as the tire deflects.
Still thinking on surface related camber. It would make sense to change the camber depending on the tire orientation with regard to the ground. But the old pacejka (89) is not designed for motorcycles so not good with high camber values.

Answers generate more questions... will this ever end? :)

This topic is closed to new replies.

Advertisement