Advertisement Jump to content
Sign in to follow this  
vadevaman

How to make a stable car physics?

This topic is 1799 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

Well, I'm currently confused on how to achieve a stable simulation. My current simulation is good in terms of driveline, suspension and tires.
It works good with Joysticks and keyboard. But what I noticed is that when I use a ffb wheel, I notice that after a heavy braking the car wants to spin out. And I cant seem to recover. The car setup is a FR drivetrain, with a weight balance of 52/48

 

I use a raycast method for the whole wheel/suspension setup.
I use the calcualted suspension force as the load for the wheel.

I calculate the SlipAngle and SlipRatio the SAE950311 algorithm(with relaxations).
Tho I have to localize the tanSlipAngle and differentialRatio variables, otherwise the car will start springing around on bare ground, mostly caused by slip ratio.

 

The tiremodel I'm using is Pacejka89 + Beckman combined slip model.
I add the tire forces to 4 points of the car (mainly the wheel position + rollcenter offset (I dont know if this is correct, but it seems to make the simulation a little more realistic)

So lately I was looking into another method, that seemed to work better under braking.

Applying forces and torque directly do the body depending on the cg position + roll center positions (as jacking)

But this method seems to not entirely like my wheel load method (because of bumpstops and antirol bar calcs, I have to disable them to get it working) Also at low speed, it seems like this method wants to float sideways.

So I finally decided to come here and ask for some help. How are you guys initialising vechicles these days Do you apply forces to 4 points of the rigid body? Or do you apply the forces & torque directly do the body?
And how to calculate the wheel loads / weight transfer if usuing the cgOriented method?

Also about roll centers, where to use them exactly if I'm using the 4 point method?

 

Any help would be apriciated!

Thanks for your time

Share this post


Link to post
Share on other sites
Advertisement

Hi, we are doing pretty much the same, simulation wise smile.png

I was also playing with jacking forces and roll centers but the whole thing proven to be much better without them.

Probably because my not so proper suspension geometry and here would the "super-knowledge-of-setting-up-a-race-car" come handy. Calculating upan a bad setup .... hmm smile.png

 

I apply every forces (tire/aero..etc) on the body.

 

Quick cheats you may try;

1. Lower the CG a bit (not much, centimeters, or inches maybe smile.png )

2. Use stiffer suspensions at the front

3. Check the brake bias, rear wheels should not lock prior to fronts

 

Also make sure your rear wheels touch the groundwhen braking. I had issues with suspension and tire movements (oscillations), and big pitch torques made the rear wheels pop up from ground. So I'm using some threshold, the tires don't lose traction at once when they lift off.

 

Hope some of these help.

Edited by bmarci

Share this post


Link to post
Share on other sites

Thanks for the reply, this is exactly what I have done to get stability but, this results in Forza like cars.
You know, behaving correctly, but theres minimal bodyroll and the simulation doesnt seem soo real visually.

I mean when you are going fast, and brake hard the car will introduce bodyroll even with stiff suspesnsion. This is the real behaviour of a car, you can see this sort of behaviour in nfs shift and rfactor. For example a car produces 800nm of torque and has a coilover set of like 80kNm at front and 70kNm at back. At launch and braking you will see the weight transfer, body pitch?.

Anyway I have seen some videos of your sim and its quite impressive. But I have a question, the head movement inside the car, is it caused by G's, like in shift or do you have that bodyroll aswell?


..oh and are you using rays or 5 rigid bodys?

Edited by vadevaman

Share this post


Link to post
Share on other sites

Where are you applying the suspension spring forces? at the contact patch or the wheel hub?

 

Edit: I have only fiddled around a little bit with vehicle physics, so I'm no pro at that, at all. But I have found that applying the forces not at the contact point, but a little higher up has resulted in a much more stable and believable car model, even if it might not be realistic.

Edited by Madhed

Share this post


Link to post
Share on other sites


I mean when you are going fast, and brake hard the car will introduce bodyroll even with stiff suspesnsion. This is the real behaviour of a car, you can see this sort of behaviour in nfs shift and rfactor. For example a car produces 800nm of torque and has a coilover set of like 80kNm at front and 70kNm at back. At launch and braking you will see the weight transfer, body pitch?

My "race suspension" has a spring rate betwen 55 and 70kNm.

And can see the body pitch (more visible outside) even when shifting.

The "F1 suspension" has 120kNm, so not too many visible body movements.

 


Anyway I have seen some videos of your sim and its quite impressive. But I have a question, the head movement inside the car, is it caused by G's, like in shift or do you have that bodyroll aswell?

..oh and are you using rays or 5 rigid bodys?

 

Thanks! :)

 

The head movement is caused by G's and some speed related random shake. Could be done with a spring, though :)

And I'm using only one rigid body and 4 rays, but "multisampling", so technically 12 rays, and the actual ground position is aproximated with some bezier stuff.

 

I've just read something about suspensions' anti-pitch properties, but I don't realy have the idea how to code that yet. Not sure if I even need it :)

Share this post


Link to post
Share on other sites


Where are you applying the suspension spring forces? at the contact patch or the wheel hub?

I'm applying the forces to wheel hub minus a correction factor(wich I call rollcenter at the moment, but obviously is false), so front wheels have their forces applyed lower than ground patch and rear wheels higher on Y axis.

 


And I'm using only one rigid body and 4 rays, but "multisampling", so technically 12 rays, and the actual ground position is aproximated with some bezier stuff.

Hmm what do you mean by multisampling exactly? And the ground position bezier stuff... as I understand is some sort of a blend between tris, to get a smooth ground right? Like in Racer where there is a road spline mesh to get that smoothness.

Anyway, what are your typical brake friction torques and how much of pressure do you but on them and is there some sort of damping done aswell?
For my example car I use braking torque of 1350 at front and 950 at back.

The overall braking im doing like this (per wheel):

brakingTorque = brakingFrictionTorque * brakePressure; // brakepressure is user input in a range of 0 to 1
brakingAngularDelta = brakingTorque * dT / totalInertia;

 

And the angularVelocity(omega) implementation for braking

if (Abs(omega) > brakingAngularDelta)       
    omega -= Sign(omega) * brakingAngularDelta;

else

    omega = 0;

Everything seems to be ok codewise but this oversteering issue is getting on my nerves.

 

Also what do you use as your wheel load? Total suspension forces or do you do some weight transfer calculations depending on the G's?
And do you add some lowspeed friction forces to your car aswell?

Seems like my car wants to slide to somewehere, even if the force is 0, ...actually this is somewhat logical codewise because there is no forces that should be resisting the movement. I'm thinking of using slip velocityes for low speed friction modeling...

Share this post


Link to post
Share on other sites


Hmm what do you mean by multisampling exactly? And the ground position bezier stuff... as I understand is some sort of a blend between tris, to get a smooth ground right? Like in Racer where there is a road spline mesh to get that smoothness.

 

That's right, I make 3 ray-casts for each wheel. The rays' distances depend on the speed. And between the 3 intersections I fit a curve.

 

MSPaint forever: :)

ground_bezier.jpg

I use the red dots (intersection points) as the control points for the bezier curve. So I just load a "polygon soup" and voila no need to create a spline mesh for the track. Works nicely on banked curves too.

 


Anyway, what are your typical brake friction torques and how much of pressure do you but on them and is there some sort of damping done aswell?
For my example car I use braking torque of 1350 at front and 950 at back.

 

Now I use 2500Nm maximum brake torque 50:50 works well, probably because the low CG.

I'm in a middle of rewriting the whole driveline since it's a big magic, nothing to do with physics :)

 


Also what do you use as your wheel load? Total suspension forces or do you do some weight transfer calculations depending on the G's?

Total suspension forces and tire forces when there is no more spring.

 

I have a concern about suspension's anti-pitch because in this case the weight is transferred through suspension links instead of the spring. So in my interpretation the tire deflates more than the spring. Not sure though.

 


Seems like my car wants to slide to somewehere, even if the force is 0, ...actually this is somewhat logical codewise because there is no forces that should be resisting the movement. I'm thinking of using slip velocityes for low speed friction modeling...

 

Also just an idea:

It might be because of the relaxation length, since the tires don't "react" instantly to the slip angles/ratios.

This effect will be even worse if you use camber/toe in.

Share this post


Link to post
Share on other sites

Hmm your method actually looks pretty cool. And one of my friend does something simmilar actually :) I personaly stick with the single ray per wheel at the moment.


Total suspension forces and tire forces when there is no more spring.

What does your suspension force consist? Mine is spring + damper + antiroll. When bumpstop is reached I switch the spring and damper forces. I dont use tire deflection forces at the moment, because I want to sort out the instability issue first.


It might be because of the relaxation length


Could you tell me how you calculate your slip angle and slip ratio? because when I try changing the relaxation lengths all sorts of crazy stuff happen when the tanSlipAngle and differentialSlipRatio are global variables. When they are local variables (in method) things stabilize a a bit but it's still quite strange.

Also I dont want to complicate things with camber/toe at the moment. I just want to get the simulation stable at first.

Share this post


Link to post
Share on other sites


What does your suspension force consist? Mine is spring + damper + antiroll

The suspension forces are all those you mentioned, but the load is spring only (k*x).

 

Take a 50kNm spring rate. That means 50000N force is needed to shrink the spring by one meter.

So if your spring is depressed by 1cm (x=0.01, actually -0.01 when shrinking) it means the spring is being pressed by 500N force, that is the force pushing the wheels down.

 

 

I use the normal slip angle/ratio calculations. For low speed slip ratio I'm working on an alternative method which is similar to SAE950311. It works so far but not sure if it will with the new driveline sim.

 


Could you tell me how you calculate your slip angle and slip ratio? because when I try changing the relaxation lengths all sorts of crazy stuff happen when the tanSlipAngle and differentialSlipRatio are global variables. When they are local variables (in method) things stabilize a a bit but it's still quite strange.

In case of global var, is it possible you have tanSlipAngle instead of tanSlipAngle[4]  ?? ;)

Share this post


Link to post
Share on other sites


In case of global var, is it possible you have tanSlipAngle instead of tanSlipAngle[4] ?? ;)


Well, I have a tanSlipAngle per wheel clas, so no I dont have them in an array. Basically whay happens is that the car starts jerking left to right and gains speed, its like I need to reset the value, this is why I use it as a local variable and set it to zero at initialization. The same goes with slip ratio.

I wish it were 2004 when there were al lsorts of private sim projects and sourcecodes to learn from. I remember some demos made with newton physics engine but they are all gone now. :(

Currently Im doing some tests on 5 rigidbody methods, trying to see if there is some stability in this method.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!