Jump to content
Site Stability Read more... ×
  • Advertisement
Sign in to follow this  
Rapha

[Car Physics] Sharing work, ideas, formulas and car parameters

This topic is 2518 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


That makes even less sense.. I read what you wrote several times and it really doesn't wherever you found these info they are just wrong all the way. Your wheel angular speed should be a function of all the torques (and forces transformed to torque) acting on the entire transmission system, from the engine to the wheels. All these are integrated with the same formulas and, unless they are wrong, deltaT won't change the result in any tangible way. You should make sure to double check your sources because the big risk here is you claiming to have a solution to a problem that never existed in the first place but it's just a result of your fantasy.


Ok, imagine the simplest scenario. An electric motor which delivers a constant amount of torque directly to a wheel. In order to calculate the force at the tire, you need to calculate the slip ratio first, so you could look it up in the friction curve and get the force. Calculating the slip ratio requires to calculate w (angular velocity) first. How to calculate w, then? What am I missing?

Share this post


Link to post
Share on other sites
Advertisement

[quote name='kunos' timestamp='1348808530' post='4984607']
That makes even less sense.. I read what you wrote several times and it really doesn't wherever you found these info they are just wrong all the way. Your wheel angular speed should be a function of all the torques (and forces transformed to torque) acting on the entire transmission system, from the engine to the wheels. All these are integrated with the same formulas and, unless they are wrong, deltaT won't change the result in any tangible way. You should make sure to double check your sources because the big risk here is you claiming to have a solution to a problem that never existed in the first place but it's just a result of your fantasy.


Ok, imagine the simplest scenario. An electric motor which delivers a constant amount of torque directly to a wheel. In order to calculate the force at the tire, you need to calculate the slip ratio first, so you could look it up in the friction curve and get the force. Calculating the slip ratio requires to calculate w (angular velocity) first. How to calculate w, then? What am I missing?
[/quote]

you don't calculate w.. it's a status. You have your status at t0 and you are calculating your new status at t1. Wheel angular velocity is part of the status t0.

once you calculate all the forces on the system you integrate it and w is part of your result, that becomes the input status for your next iteration.

Share this post


Link to post
Share on other sites

The problem that you face in a 2D car sim are really different from any 3D car sim so it make your thread evern harder to understand.
Also, we are not just 3 but maybe hundred of people on this forum are trying to get car Physics right.


I'm not sure about that. I'm also planning a 3D car game, but first I'll make a 2D version to make sure I understand all the fundamental parts that I need.
In 2D everyting is more simple but the physics is more or less the same, eg: use only anular velocity (scalar) instead of a vector, or inertia value instead of tensors, but the principle is the same.

At the current sate I'm in the same situation as PochyPoch. I have a decent working car, only having problem with high speed cornering and stability.
As Kukos seems to be one of the guys from the old RAS discussions I'd aim a couple of questions for you directly (if you don't mind) :)

Just a couple of symptoms and confusions:

Symptoms:
1. The car behaves fine with low speed (the wheels are jerky, but no low speed relaxation, so that's ok for now)
2. Up to 40/60 km/h everything is fine, but over this limit the car becomes very hard to control, especialy with no throttle.
3. Around 80/100 km/h, understeer with throttle, and oversteer without it.
4. I tried to adjust the pacejka curve to have more lateral forces at the rear tyres, so it became mor controllable after a while (no oversteer, but more understeer), and thus the rear end becames more sticky and couldn't spin the car not even with locked rear tyres.
5. I tried modifying weight balance, and smaller body inertia value, but didn't help too much.
6. When the car starts skidding the situation becomes very "slippery", like driving on ice.
7. I tried straight Fx/Fy calcuations like: (Fx=SR*1.0*Fz) and (Fy=SA*0.8*Fz) but didn't help too much.


Confusions:
1. For SA/SR calculations do I need the velocity of the contact pacth or the wheel hub wrt the ground?
In most docs I found the wheel velocity is made up from Car's linear velocity and the Car's angular veloicty at the wheel pos.
But, the CP is moving backward as the wheel is rolling (in case of moving forward), is it an important term, or should I just forget it?
I tried this and get "better" lateral forces, so more stability, but it screws up the SR, the wheels spin slower than expected.
Also should I cap SR, eg: betweeh -1..10 ?

2. I have doubts about the afore mentioned straigh engine RPM calculation. Could that affect cornering stability?
I'm thinking in this model: Engine torque accelerates the whole drivetrain (flywheel/transmission/wheel) (clutch/diff ommitted for simplicity)
The final wheel rotation gives a slip ratio that helps to calculate the reaction torque. And apply this reaction torque back to the whole drivetrain (wheel/transmission/flywheel)
BUT, if i'm thinking right, the two calculations need different inertia values (wheel side/engine side). Is that correct?

3. I noticed some oscillation in SR when not pushing the throttle, only engine brake and drag. SR jumping between (0.03% and -0.08%) is that normal?

4. much more that I don't remember now :)

Share this post


Link to post
Share on other sites
Hi, all these points might be simply a symptom of a bug in the code... which could be anywhere, I'll try to approach it from a car dynamics point of view, assuming basic physics code is correct.


Symptoms:
1. The car behaves fine with low speed (the wheels are jerky, but no low speed relaxation, so that's ok for now)
2. Up to 40/60 km/h everything is fine, but over this limit the car becomes very hard to control, especialy with no throttle.

Unless you have explicitly coded a speed sensitivity ( I doubt that because it's a fairly new development and it is usually neglected in literature) in the car, this is usually the sign of a bug.. a well balanced car (ie, right tyre grip distribution, suspension and anti roll bar setup, aero balance) should get more stable as speed increase.

3. Around 80/100 km/h, understeer with throttle, and oversteer without it.

Could be CG too high, too much "coast" torque.. wrong or missing implementation of a proper differential

4. I tried to adjust the pacejka curve to have more lateral forces at the rear tyres, so it became mor controllable after a while (no oversteer, but more understeer), and thus the rear end becames more sticky and couldn't spin the car not even with locked rear tyres.

That's the fascination of car development, to get a car that is drivable and well behaved in real life is VERY hard.. should it be any different in a simulator? ;) You need to hit a sweet spot that usually comes with experience, real world values and study of car dynamics and setup. Of course wrong tyre modeling or differential modeling could produce bad behaving sims.

5. I tried modifying weight balance, and smaller body inertia value, but didn't help too much.

Usually smaller rotational inertia makes the car more twitchy.

6. When the car starts skidding the situation becomes very "slippery", like driving on ice.

This is usually a sign of blindly trusting some common found pacejka sets, they do a good job in reproducing the "grip" side of the curve but a piss poor job in reproduction the sliding side of the curve. You're pretty much by yourself in this., as there is no reliable way to measure tyre behavior after the grip peak it all comes to the developer driving experience and creativity... so, start spending time on a real car on the limit and try to figure out why and how to reproduce that behavior in the sim... this is currently the most active part in PC driving sim research and most simulator have abandoned the pacejka approach because it just doesn't work.

7. I tried straight Fx/Fy calcuations like: (Fx=SR*1.0*Fz) and (Fy=SA*0.8*Fz) but didn't help too much.

How can they work? It's virtually infinite grip there, they only can give you an idea about what's called the "terminal behavior" of the car.. but that's old theory and is pretty much worthless.

Confusions:
1. For SA/SR calculations do I need the velocity of the contact pacth or the wheel hub wrt the ground?
In most docs I found the wheel velocity is made up from Car's linear velocity and the Car's angular veloicty at the wheel pos.
But, the CP is moving backward as the wheel is rolling (in case of moving forward), is it an important term, or should I just forget it?
I tried this and get "better" lateral forces, so more stability, but it screws up the SR, the wheels spin slower than expected.
Also should I cap SR, eg: betweeh -1..10 ?

You want to use the velocity of the contact point but without the angular velocity component. So if you have a rigid body for the suspension hub you'd call a function such as getVelocityAtWorldPos , or transform the point into hub's frame and call something like getVelocityAtLocalPos .

2. I have doubts about the afore mentioned straigh engine RPM calculation. Could that affect cornering stability?
I'm thinking in this model: Engine torque accelerates the whole drivetrain (flywheel/transmission/wheel) (clutch/diff ommitted for simplicity)
The final wheel rotation gives a slip ratio that helps to calculate the reaction torque. And apply this reaction torque back to the whole drivetrain (wheel/transmission/flywheel)
BUT, if i'm thinking right, the two calculations need different inertia values (wheel side/engine side). Is that correct?

that is correct, because ratio influences inertia. There is a nice document written by Ruud Van Gaal at racer.nl that explain how to calculate "effective inertia" as seen from different sides of the drivetrain.

3. I noticed some oscillation in SR when not pushing the throttle, only engine brake and drag. SR jumping between (0.03% and -0.08%) is that normal?

With the car in movement on a flat road no, that isn't normal... it might be a wheel angular inertia too low wrt to the forces and the deltaT.

Share this post


Link to post
Share on other sites

Unless you have explicitly coded a speed sensitivity ( I doubt that because it's a fairly new development and it is usually neglected in literature) in the car, this is usually the sign of a bug.. a well balanced car (ie, right tyre grip distribution, suspension and anti roll bar setup, aero balance) should get more stable as speed increase.

The only speed sensitive parts are aero drag and rolling resistance for now, but I was wondering how aero downforce works as speed increases. Is the front/rear balance constant or changing as the car moves (probably not constant, but is the change significant?)


Could be CG too high, too much "coast" torque.. wrong or missing implementation of a proper differential

h=0.5m, L=2.55, track=1.9
It shouldn't be high, but there is no differential at all. First I'll try how the rear wheels behave if I disconnect them from the engine at turning.


This is usually a sign of blindly trusting some common found pacejka sets, they do a good job in reproducing the "grip" side of the curve but a piss poor job in reproduction the sliding side of the curve. You're pretty much by yourself in this., as there is no reliable way to measure tyre behavior after the grip peak it all comes to the developer driving experience and creativity... so, start spending time on a real car on the limit and try to figure out why and how to reproduce that behavior in the sim... this is currently the most active part in PC driving sim research and most simulator have abandoned the pacejka approach because it just doesn't work.

You might be right :) But I found those values at the same place, maybe PHORS or Genta's ferrari. So you say, my curves can be right but they don't belong to the same tyre?

In "the sliding side of the curve", you mean over the slip limit?
I read somewhere, it is a common misbelief, that the curve falls off over the slip limit drastically. So a linear appriximation with caping at the limit could give "close enogh" result. If not considering load sensitivity.

Also it would be nice to see some real values, not curves, just sample values eg: (SR=0.01, Fz=3500N, Fx=???) and the same for Fy, just to see if we even have reasonable results.
Is there any "healthy" ratio between Fx and Fy (at peak). I just checked, and my FxMax is greater than FyMax.
Are these values reasonable for a 255/50ZR16 tyre:
Fx: Load=3KN, PeakSR=0.11, MaxFx=3240N, InputSR=0.03, Fx=2211N
Fy: Load=3KN, PeakSA=8.6°, MaxFy=2834N, InputSA=4°. Fy=2519N



that is correct, because ratio influences inertia. There is a nice document written by Ruud Van Gaal at racer.nl that explain how to calculate "effective inertia" as seen from different sides of the drivetrain.

Yes, got that :)


3. I noticed some oscillation in SR when not pushing the throttle, only engine brake and drag. SR jumping between (0.03% and -0.08%) is that normal?
With the car in movement on a flat road no, that isn't normal... it might be a wheel angular inertia too low wrt to the forces and the deltaT.

DeltaT is 1ms, Wheel mass=15kg, Radius=0.33, Inertia=0.81 In case of free rolling wheel.
Is it worth using the relaxation length method at high speed to smooth the SA/SR values?

Share this post


Link to post
Share on other sites
The only speed sensitive parts are aero drag and rolling resistance for now, but I was wondering how aero downforce works as speed increases. Is the front/rear balance constant or changing as the car moves (probably not constant, but is the change significant?)[/quote]

Surely the levels of downforce go up as the car speeds up because as the car get closer to the ground it will increase aero efficiency. The forward/aft movement of the aero center of pressure varies a lot, older cars suffered from this a lot, newer cars are less prone to move it around a lot, but it's just a trend, not a automatic fact.

h=0.5m, L=2.55, track=1.9
It shouldn't be high, but there is no differential at all. First I'll try how the rear wheels behave if I disconnect them from the engine at turning.[/quote]

It's not crazy high. Differentials are one of the key element to tune the car behavior and can really change the way the car is behaving at corner entry, apex and exit. It's really important to get those right... in my games most key improvements came from diffs and not from tyres.


You might be right smile.png But I found those values at the same place, maybe PHORS or Genta's ferrari. So you say, my curves can be right but they don't belong to the same tyre?[/quote]

Sadly, to be a good car simulator developer you need to invest lots of money trying to acquire every available book and paper on the matter. I have a huge library with references to interesting graphs and formulas all collected so I can easily find what I need when I need it. Once you start seeing tyre curves from different sources you start to see patterns and things like tyre models just become tools for you to reproduce those patterns. I don't think those tyres pacejka sets commonly found on the internet are a good starting point to develop a sim at all. I strongly suggest you to start your journey getting the Tyre Dynamics book from Mr. Pacejka himlself.. at least you'll understand what kind of trip you have ahead of you :) (and get good data to start with).


In "the sliding side of the curve", you mean over the slip limit?
I read somewhere, it is a common misbelief, that the curve falls off over the slip limit drastically. So a linear appriximation with caping at the limit could give "close enogh" result. If not considering load sensitivity.[/quote]
Yep, I would say that is generally true. I would suggest to start with a "Brush Model" instead of a pacejjka, it does have a touch of "floaty" feel to it, but, being a physical based model it's easier to understand and easier to improve, while with pacejka you are starting from nothing every time you have to work on a new tyre.

Also it would be nice to see some real values, not curves, just sample values eg: (SR=0.01, Fz=3500N, Fx=???) and the same for Fy, just to see if we even have reasonable results.
Is there any "healthy" ratio between Fx and Fy (at peak). I just checked, and my FxMax is greater than FyMax.
Are these values reasonable for a 255/50ZR16 tyre:
Fx: Load=3KN, PeakSR=0.11, MaxFx=3240N, InputSR=0.03, Fx=2211N
Fy: Load=3KN, PeakSA=8.6°, MaxFy=2834N, InputSA=4°. Fy=2519N[/quote]

As I've said, you can find some of those on books.. and, if you get in touch with teams, see some data straight from tyre manufacturer. Fx to Fy ratio varies a lot, I found a ratio of 1.1 (Fx=Fy * 1.1) is a good starting point. In your example I would say Fy is quite low for a 255 tyre.


DeltaT is 1ms, Wheel mass=15kg, Radius=0.33, Inertia=0.81 In case of free rolling wheel.
Is it worth using the relaxation length method at high speed to smooth the SA/SR values?[/quote]

Relaxation length is needed at low speed not at high speeds. Although 0.8 seems a bit low for a 0.33m radius tyre the time step should be enough to handle that.. I am more inclined to say it's a bug.

Share this post


Link to post
Share on other sites

Sadly, to be a good car simulator developer you need to invest lots of money trying to acquire every available book and paper on the matter. I have a huge library with references to interesting graphs and formulas all collected so I can easily find what I need when I need it. Once you start seeing tyre curves from different sources you start to see patterns and things like tyre models just become tools for you to reproduce those patterns. I don't think those tyres pacejka sets commonly found on the internet are a good starting point to develop a sim at all. I strongly suggest you to start your journey getting the Tyre Dynamics book from Mr. Pacejka himlself.. at least you'll understand what kind of trip you have ahead of you (and get good data to start with).

Yes, I've already started spending money :) and was reading about a lot of interesting new things. And whatever new formula I just find seems to greatly affect the final "experience" :)
I've already collected a bunch of sample curves, but until I implement all neccesary components, I cannot be sure if the problem is with the tyre or with some missing part.


As I've said, you can find some of those on books.. and, if you get in touch with teams, see some data straight from tyre manufacturer. Fx to Fy ratio varies a lot, I found a ratio of 1.1 (Fx=Fy * 1.1) is a good starting point. In your example I would say Fy is quite low for a 255 tyre.

Ok, I try with a better curve, twice as many forces? What do you think? :)


Relaxation length is needed at low speed not at high speeds. Although 0.8 seems a bit low for a 0.33m radius tyre the time step should be enough to handle that.. I am more inclined to say it's a bug.

Maybe I use a wrong formula for wheel inertia: (not considering drivetrain inertia, only free rolling wheels)

V1: (one component, cylinder)

I = (m * r^2) /2
I = (15 * 0.33^2) /2
I = 0.81

V2: (two components, tyre + rim)

I = (m1 * r1^2)/2 + (m2*(r2^2 - r1^2)) /2
I = (8 * 0.2^2) /2 + (7 * (0.33^2 - 0.2^2) /2
I = 0.16 + 0.24
I = 0.4

Even worse, do I miss something?

Share this post


Link to post
Share on other sites

you don't calculate w.. it's a status. You have your status at t0 and you are calculating your new status at t1. Wheel angular velocity is part of the status t0.
once you calculate all the forces on the system you integrate it and w is part of your result, that becomes the input status for your next iteration.


Okay... this may sound silly but that simple paragraph supposes a lot of clarification to me. I'm using Unity 3D, so I'm constrained to a subset of the physics engine (PhysX). No access to the integrator at all - only rigidbody dynamics that just work and the ability of applying forces to it (rigidbody.AddForceAtPosition).

But it doesn't mean that I'm trying to solve a nonexistent problem. Now I have a much better picture of the problem I'm working on, and it has to do with another of your replies:


Sadly, to be a good car simulator developer you need to invest lots of money trying to acquire every available book and paper on the matter. I have a huge library with references to interesting graphs and formulas all collected so I can easily find what I need when I need it. Once you start seeing tyre curves from different sources you start to see patterns and things like tyre models just become tools for you to reproduce those patterns. I don't think those tyres pacejka sets commonly found on the internet are a good starting point to develop a sim at all. I strongly suggest you to start your journey getting the Tyre Dynamics book from Mr. Pacejka himlself.. at least you'll understand what kind of trip you have ahead of you (and get good data to start with).


My goal is to develop the most realistic vehicle simulation that could be achieved only with the minimum (and simplest) math involved. Of course, it wouldn't be comparable to the high-end solutions, but it will provide developers a rather simple method that could be easily understood, implemented, and tuned for each specific project. Thus, developers with limited physics knowledge (as me) could still develop good vehicles that would be realistic enough for most projects. Edited by Edy

Share this post


Link to post
Share on other sites

In summary, you need these kind of formulas only when developing high-end ultra-realistic vehicle simulation with real tire sets (think on netKar Pro, rFactor, etc). But you are not required at all to use these approaches for developing realistic vehicle physics. These methods are inherited from the automotive industry and it's quite difficult to implement them properly in video games.
Really ? oO i just learned it. I had the feeling a lot of games (like GTA, or even more arcade games) use the curve approach, even if they tweak it rather than directly implementing the formula. Your framework doesnt seems too much realistic to me, and it's using it right ? I was just plotting simple curves scaled by weight load, and (re)discovered today, that forces do not linearly increase with Fz, thus making proper use of the formula important to me, or at least it is what i was thinking until i read this.


Yes, you can use a curve approach, but not necessarily a pacejka one. As Kunos pointed out in another of his replies, once you see the pattern of the real friction curves you can use any method for reproducing them. That framework uses those patterns as you can see at the demo (press B, then shift-B to see the curves). However, that framework is based on a workaround to the standard wheel component of the physics engine (no real-world physics on the tire). So things like lateral-longitudinal force combination are roughly calculated, and the method is targeted for gameplay instead of realism.


> Use wheel distance to CG to calculate weight transfer lateraly and longitudinal. Combine those two.
This is most probably wrong... you don't calculate weight transfer, it should be automatically happening in your rigid body physics


That's right, you don't need to calculate this. In my case (Unity 3D) I have rigid body physics that just work. So my vehicle is constructed simply as a rigid body with 4 contact points and a simple suspension on each one (spring + damper). If I put this "vehicle" over a terrain it will behave as if it is sliding on ice (no friction) but suspension, weight transfer and weight load at each contact point will just work.

What my tire simulation does is simply applying the appropriate force at each contact point according to the vertical load on that point. If the forces are calculated and applied properly, then the rigid body will behave as a vehicle by itself, which actually does in my work-in-progress framework. Edited by Edy

Share this post


Link to post
Share on other sites
Again, i am sorry but i think this thread is confusing.
When i look at the first post and the evolution of the thread, i can't find anything related.
Its like everyone is talking about his problem and mix everything.

I will be difficult for someone who have a specific issue to find answers by looking at this thread..

Part 1 - What should i absolutly do to make this a fun game with drifts, skids and such things ?[/quote]
This title only is just nonsense...
There is no miracle recipe to make fun game or drift game.

First the random guy who have no knowledge about car physics should be oriented to some reading first.
The famous Marco monster tutorial is i guess a good start :
http://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html

Also, the way you explain things is hard for a newcomer to understand.
The advice order is completely wrong, and doing thing that way is total nonsense.

Again no offense, you want to help people and help yourself, thats a great idea, but you should at least do it seriously..

Basically separating Car physics in multiple categories would have been a better approach...
Tires, Transmissions, Engine, Gear Ratios, Weight Transfer etc...
Again marco's monster tutorial do that better than you do.

Use the powered wheels velocity to determine motor RPMs. Based on player throttle input, and engine torque curve, generate a torque force for powered wheels.[/quote]
Another exemple, how did you came to this conclusion ? Looks like a copy and paste.
As kunos mentioned this is backward thinking, and not very logical to me.
Of course i know that this approach is valuable because i already deal with it by seeing some car physics tutorial on the net.
But for a new-comer, it will be difficult to understand anything...

Anyway..

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!