Advertisement

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

Started by September 27, 2012 02:01 AM
36 comments, last by bmarci 12 years, 2 months ago
jujunosuke,
I'm sorry but I feel your post was not so constructive.



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

As far as I understand this topic is not about a specific broblem, more likely about all problems. If you have a specific issue, just read the FIRT post which is constantly edited and expanded, as the discussion goes on.


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.

Yes, because people usually don't share hard earnt techniques easily. So we must go the harder way to share our problems, and work out the answers together.
Kunos is the far most experienced here, but nobody expects him to copy/paste his super tyre model formulas/parameters that he worked out in many years, his comments are valuable but only showing the right directions.
This way you are right, the title of this topic will not work, PochyPoch was naive about it :) But since this topic became the most visited car topic, people ask here.


This title only is just nonsense...
There is no miracle recipe to make fun game or drift game.


I don't think any of us who just started playing with car simualtion are about to make hyper realistic simulation for a racing team or a car factory.
At this level, it's all about game and fun with an acceptable level of physical accuracy, and thus as everything in game programming it's all about cheating as much as possible. So there ARE miracle recipes as long as you are not a professional in aero dynamics or in suspension geometry setups.
Later when we work out everything about differentials and tyre simulation those magical solutions will disappear.


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

So then, let's help him make it better. The Marco Monsters' is almost 10 years old, and the only one well understandable for beginners.
You are partially right, this tutorial hasn't reached that level, but I'm sure in time it will.
It's high time someone started making an extended version :)
bmarci, thanks for your answer and your point, but i think you don't get what i tried to say.
I am not native English so, it may be the reason i explained it bad.


I'm sorry but I feel your post was not so constructive.[/quote]
It was, i tried to explain why this thread was confusing to me. If you don't want to admit that some people will not understand that thread thats your problem.
But don't say that my post was not constructive.


As far as I understand this topic is not about a specific broblem, more likely about all problems. If you have a specific issue, just read the FIRT post which is constantly edited and expanded, as the discussion goes on.[/quote]

A web page with some photos, or even Flash based animation would be so much better than this post.

I don't think any of us who just started playing with car simualtion are about to make hyper realistic simulation for a racing team or a car factory.
At this level, it's all about game and fun with an acceptable level of physical accuracy, and thus as everything in game programming it's all about cheating as much as possible. So there ARE miracle recipes as long as you are not a professional in aero dynamics or in suspension geometry setups.
Later when we work out everything about differentials and tyre simulation those magical solutions will disappear.[/quote]

I am not even talking about realistic simulation, i am talking about something really simple, the basics.
Beside the fact that marco monster is 10 years old, it cover everything so well, its just the best way to start in my opinion.

And gamedev forum should be there to help you to answer question on a particular point that you don't understand for example.

Of course, its always interesting to see some reading on car physics, a subject that passionate all of us, but the fact of melting all kind of question and answer together make it really confusing and not that easy and enjoyable to read IMO.

I don't have any problem with "tutorial" or "resource" kind of thread, but at least, it really need to be done more seriously.
That was my 50 cent.
Advertisement
Hi to all beloved co-posters !

Bmarci, thanks a lot for saying what i was going to say ^^

More precisely, i would say, yes, this is going to fail, as almost any other car topic on the forum. Of course there are a lot of errors in my (very) simple explanation. The whole purpose was to get people to say "hey this is not the way you should do that !", or even more valuable "hey there is a faster/easier way to do that !". So if i had all knowledge already, i would finish my game and make a real tutorial instead of a "general car ways of doing things" topic smile.png

My goal is ultimately to explain everything we learned on the first topic, and maybe if i estime myself enough give some advices (like do not believe marcos tutorial will give you a nice car ^^). I have a LOT of litterature on the subject i will post, etc. But right now, i feel like trying to make a "reference" first post is kind of a waste of time as there is too much things to discuss, and making it look "good" won't make it good for real. The idea is to get people to understand this is an open debate and ideas/tips sharing topics, which i hope will let us gather enough intel to be able to provide a few good advices on the first post.

As i see it, all kinds of handy formulas, links, tips, and even different "ways" of doing things will be explained in the first post. Bu right now, this thread is highly unrecommandable, especially for newcomers, there are better places to start, like marcos monster, phors or the tutorial on gamedev, which are all good reads.

And, finally yes, i think all noobies car devs are going the same way those times, and maybe a fresher starting point would be necessary.

Beside the fact that marco monster is 10 years old, it cover everything so well, its just the best way to start in my opinion.[/quote]
Oh yeah, +1k to that. And maybe even before that getting familiar with driver knowledge before going into physics. The value of the first post when completed would not be to do what marcos did, but instead, starting where it stopped. So let's say you have implemented everything he said, and even a few more things, but you are very disappointed because your car is not feeling right. I already learned very valuable things (like role of differentials and so), that i think are worth explaining in the first post, in time, when i'll have implemented and understood them myself. And finally having a few videos demos, data sets and reference values would be a great contributions for people coming from marcos tutorial or trying to implement it.

Of course, its always interesting to see some reading on car physics, a subject that passionate all of us, but the fact of melting all kind of question and answer together make it really confusing and not that enjoyable to read IMO.[/quote]
The fact is, we (i) have so many questions, i feel like creating topics for all of them would result in terrible forum flooding. So the idea is to ask things as they are coming, and when i figure out enough of them i'll summarize the first post well smile.png And then it would be a great time for constructive feedback, as we are thinking towards future readers and explaining things correctly.

---

That being said, let's go back to main topic : car [s]science[/s] alchemy !

---

EDIT : Wow i just realized there are very interesting things being said in the previous car topics ! Maybe some of my questions have been answered there. If that is don't bother linking the other topics, i'm reading them right now smile.png

A few words on the differential topic i started : i was just talking of a flat multiplier in my sim actually : engineTorque * gearRatio * diff * throttleInput. Very dumb thing, compared to how advanced a real differential is. I personnaly do not use an axle, instead i add torque to the drive wheels directly, and so, they get individually slowed/accelerated in a corner. If cornering without throttle, the inner wheels is going slower than outer wheel (normal), but if cornering with throttle, that's the opposite. Actually wihtout differential, the inner wheel has to slide on itself, which works but is far from good. And must have an influence on cornering.

Anyway i just deactivated slip ratios, engine torque and all things related to concentrate on drifting and cornering behaviour. No traction circle either for now. So i'm not on power drifting, but more on braking->more weight to front->oversteer drifts.

I think i'll code real suspesions/springs and enhance my mastery of steering_input_control / general lateral forces manipulations before i get more into combined lateral and longitudinal grips. Step by step !

---

the easiest and more common way of getting load is to treat the tyre as a spring and get the load from that spring compression... no calculation needed.


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.


No calculations... does not work for me, sorry ^^ You mean the physical engine does it for you ? You mean, the spring/wheel will compress because of car accel, and the final force on each tyre will be way more reasonnable than in a vehicle without suspension ? I still have a doubt if you're suggesting NOT even consider car acceleration, or just don't use it AS IS because it is very stupid (which is obvious ! As you pointed it, even a tire is a kind of suspension on itself).

If that is what you mean, then we agree ! Either way, please explain further, the "no calculation" thing.

As all front/lateral forces get eventually multiplied by the wheel load, we can say getting the wheel load right is maybe as much or even more important than getting the initial values right. I had much trouble with that, and honestly for this particular subject i kind of miss examples. When i look at a big pickup truck i can see the springs getting highly compressed. Marcos state something like "xxx acceleration > formula > xxx Fz on back wheels, so you accelerate faster". The fact he didn't talked about car suspesions made me think :

  1. It is not a very important part of the simulation (VERY wrong i think, now)
  2. Suspension or no, i CAN get the force he is talking about, eventually, and maybe suspensions will just make the weight shift process a little slower (i guess it is really wrong too).


Here is a problem i still have : if weight transfer is more than a FEW percents, car can spin very easily or behave odd. When i see the raw acceleration weight transfer outputs, i find it hard to beleive spring/dampers can convert a totally incontrolable car in something smooth. So i looked elsewhere.... For a too long time. I mean, will i go from 15% weight transfer to 1% ? Or more from 15% to 12% ?

What is a typical cornering car weight transfer values ? On something like a lambo, and a drift car (to have extremes), if i decelerate from 200Km/H to 150Km/H, what can be the front/rear weight repartition at corner entry ? middle ? end ? Is it ok to have almost all cars to spin if the transfered weight ratio from back to front is more than 10% during serious cornering ? (i know you miss the steering and lateral tyres forces intel, but i'm just asking to have an idea of the effect of suspensions).

Actually i get pretty good results with 1% ~ 5% maximum weight transfer amount. It all depends of steering and lateral forces, wich varies from one car to an other.

---


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


I generally have this behaviour too. Slip angle is initially higher at front, it makes the car oversteer (with or without weight transfer). If accelerating, the cornering radius is getting higher very fast (understeering). Even more noticeable if you have an arcade front velocity directly coming from throttle instead of SR/torque. I think (hope) Kunos is right and a differential would help to create a front acceleration vector which has a small angle instead of 0. Thus helping in cornering. I was not confident trying to implement this for now, but i'm looking toward formulas and tips helping to create a diff. Unless the formulas are pure magic, i guess it is very hard to do this quickly.

---


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

+1. We need some real life values with a known-setup car to help us. Do you have the name of a book wich specifically has real examples ? Physics of racing maybe ?

---

A few questions :

  • What is a reasonably good lateral deceleration a tire can produce ? I mean, if i am at 50 meters/second front and want to turn right at 90° without making a huge drift, how much lateral G are realistic ? Or in other words what can be the cornering radius ? Reason i am asking this : my game is currently top down, and to see curves, they have to fit on the screen. So, i know my driving environment is far from realistic, and thus i need VERY good tires to turn. So let's say you kick a car lateraly so the Fy speed get instantaneously to 50 meters/s. What would be a reasonable stopping time ? 1s ? 5s ? I have done some research and it seems, F1 car do something like 5G of lateral acceleration, while a regular car is closer to 1G. But no one is trying to take a 90° corner with a regular car at 150 Km/H. I guess if it a crossover it is not even doable even if drifting ?
    If i have a 1500Kg car, with inertia of 3000 and a pacejka curve like this : peak@4° = 1.2, value@90°=1.0 my car handling is credible, but totally catastrophic, i cannot take any decent corner above 50KmH. I have to go to 20 or more in the 90° to make the car turn ok.
  • Do you see the peak of the long/lat curves as the maximum radius of the traction ellipse in that direction ?
  • Is there a formula to create an ellipse knowing the X/Y radiuses ?
  • If a front pacejka curve is not matching the lateral one : let's say i draw curves by hand and i am modifying them separatly as i try things. Is there a point at wich it is stupid to hope anything because those are so closely related (with SR/SA, traction circles) that everything has to be in perfect harmony (ie: lateral forces physically accurate regarding to front ones). That means i cannot let the player upgrade its front grip without having lateral grip to increase as well ?
  • [s]In most car simulations, when the car starts to slide, it acts as it keeps sliding, like if a slide situation was more able to create a slide situation in the next tick. Or like if when sliding has started, the friction forces are modified. That make sense if you consider static/dynamic friction, but afaik, a tire cannot bo seen from this simple perspective. If i am cornering at 150Km/H, i guess everything is sliding here and there a little, and there no such thing as : "static friction, everything is alright"--> "sliding, so i have lost traction and cannot do much about it". But i don't know, we always read the patch is kind of "not moving" at a given time, so maybe even when cornering at high speed, i should consider the patch as static ? And then i would need to find out if it is in static or dynamic friction mode ? No idea if it is a legitimate question, and even less idea on how to determine that.[/s] Funny that jujunosuke had the same hope than me on this ^^ Anyway the response of Kunos is absolutly no static friction.

    And finally, last but not least, something very important to me i am still not sure :

    • It is said the more acceleration, the more weight on the tire, and the more weight on the tire, the more grip. So why during intensive cornering, the outer wheels (which are the most loaded) are always the first to slide ? My guess ares :

      a) It only happens when the lateral speed gets too high. So something related to static/dynamic friction like i am asking above. And lateral speed would be higher on outside side of the car ? Or even more crazy : in fact all wheels are sliding at the same time, the outside wheels are not always the first to slide in those situations.
      b) Somehow the slip angles of the outside wheels are getting too high, the curve is getting down and slipping occurs ?
      c) At some point, more weight means less force ??? I know the weight has diminushing returns on generated forces, it is not entirely linear. But when i looked at the values, even if not neglectible, it does not makes sense that the outer wheels slide first.
      d) Only happens because of differentials + driver pushing throttle. So outside wheels are slipping, traction circle is outranged and increased weight is not important enough to counter the loss of magnitude of the "raw" lateral friction.
      e) It is something else, maybe related to camber, or the fact that the car is simply not well balanced with too much weight on one side which means... too strong lateral forces ?
lots of questions as usual... the no calculation thing is very easy.

Tyre is a spring, and should be modeled as such. Usually there are 2 approaches to modeling tyres/suspensions:

1) "Arcade" mode, the car is a single rigid body, suspensions and tyres are simulated with 4 ray casts and with a spring, or better, with 2 spring in series. In this case, the force that the spring will send to the car is also your load on the tyre.

2) "Sim" multibody approach. Here each tyre is a separated rigid body connected to the car body either with a joint, more joints, or more rigid bodies.
In this situation the tyre is a spring too, when it collide with the ground it will "sink" into it, this "deflection" is used as a compressed spring, it pushes tyre up at it represent your load. So simply:

tyres->load = tyres->deflection * tyres->spring;

For tyres you are looking into the 200,000 N/m spring rate and a 400 N/ms for damping.
With this system, everything is "automatic" as long the point of application of your forces is correct. So you brake, the weight goes forward, it will "compress" the tyre more into the road (just as in real life) and by measuring this deflection you get the instant load. Links, suspensions, springs and dampers are automatically taken into account.

Tyre lateral grip
It depends a lot.. a typical road tyre will give you 1.0 - 1.1 G.. with load sensitivity and all you should get close to 1.0G on a skidpad. A normal road car with 1.0G lateral acc is considered VERY good (ie. the BMW Mini scores a tad less than 1.0G and is considered a very good handling car).
Casual players usually find this VERY low.. this has lots of possible explanations:

1) No real experience with real cars.. and I mean track experience in a competitive way, not the kind of experience you get being an idiot on public roads.
2) The result of 1 is that no driving skills are developed... typical sign, Joe-I-Go-Fast goes too fast into a corner, the car will understeer and he turns more into the corner, making understeer worse and going even more wide into the wall.
3) They are used to other games either arcade a-la PGR or F1 games where cars have huge amount of grip.

You can try to solve the problem by increasing the grip, but that will screw up everything else on the car, it will roll more, pitch more, and, since the tyres have a much bigger potential to generate forces, the car will be more twitchy..

Continuing the grip references, for a high performance road tyre (high end supercars) you see 1.2 - 1.3
Racing slick tyres range from 1.4 to 1.9 depending on compound.

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni

As for the loaded sliding tyre thing.
The first chapter of every car dynamics book will talk about "load sensitivity", which is an essential concept in car dynamics.
The more load on the tyre the more the friction coefficient goes down. A tyre that can do 1.2 at 1000N, might give you 1.1 at 2000N . That is why the loaded tyre will be the first one to "break" grip.

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni


2) "Sim" multibody approach. Here each tyre is a separated rigid body connected to the car body either with a joint, more joints, or more rigid bodies.
In this situation the tyre is a spring too, when it collide with the ground it will "sink" into it, this "deflection" is used as a compressed spring, it pushes tyre up at it represent your load. So simply:

tyres->load = tyres->deflection * tyres->spring;

For tyres you are looking into the 200,000 N/m spring rate and a 400 N/ms for damping.




This is what I always had hard time to imagine :)
Using the spring/damper formula:

F = -kx - bv

where:
k is the spring rate, 200000 in your example
x is the deflection

So the load is simply kx?

Also, in a multibody situation, suppose the wheels are made of steel, so only one spring is there.
The spring would act on both the wheel and on the body. This becomes more obvious when the car lifts off the ground, so the spring pushes the wheel down and the body up.
In this case the applied spring force is divided between the wheel and body in the ratio of their masses. Is that correct?
Advertisement
no, a force is a force and is independent from masses. The spring is generating exactly the same force on both bodies, in opposite direction (Newton's third law) .

Acceleration, which is F/M becomes, of course, dependent on masses.

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni

One more thought on suspensions (for dummies (mostly myself) ) through an example.

For the simplicity I'd represent a car with a box with 4 corners for each wheel attachment point, and 4 points for the wheels' contact points.
The 4 points are constrained to the 4 corners of the car with a spring/damper.
To make our life more difficult let our wheels have their own mass.

The spring/damper has the following parameters:
k = spring rate
b = damping rate
L0 = restlength (is it the measured length of the spring if I put it on my table???, no forces acting on it)
Lmin, Lmax = minimum/maximum extensions (how much can it be compressed or stretched)

Given the spring formula; F=-kx-bv
where,
x = spring compression (difference between spring current length and restlength)
v = velocity difference between the two ends of the spring (if a wheel is attached this is the vertical speed of the wheel)


In the simulation step;
1. Suppose we have a working dynamics, our car starts freefalling at the first step.
2. The 4 wheels' contact points sink into the ground, so the "x" gets a nonzero value, thus one can calculate the current load on the tyre W=kx
3. Since x is nonzero a spring force is generated (F) that is applied to the contact point and the corresponding corner of the box.
4. If the wheel is touching the ground all spring force (F) is applied on the box corner, otherwise it's divided between the wheel and the body;
5. Applying that force back on the car body, changes its linear and angular velocity, and the vertical movement of the wheel
6. Now we can calculate the new x and v for damping in the next step. The Lmin and Lmax can be used to limit these values.

^^^ Could this work????


Couple of things to clarify;
1. Does the amount of weight transfer depend on the stiffness of the spring?
Or, is the same weight transferred with a 200kN/m spring as one with 50kN/m but much faster?
2. The value x is almost always nonzero, so the spring is never reaches the restlength and oscillates forever.
3. Maybe not relevant, but if the suspension has double springs (like all my lego cars) can it be handled as one, just summing the spring and demper rates?


1. Does the amount of weight transfer depend on the stiffness of the spring?
Or, is the same weight transferred with a 200kN/m spring as one with 50kN/m but much faster?
2. The value x is almost always nonzero, so the spring is never reaches the restlength and oscillates forever.
3. Maybe not relevant, but if the suspension has double springs (like all my lego cars) can it be handled as one, just adding the spring and demper rates?


1 - weight transfer is the same, just happens at different speed
3 - There are formulas to combine spring rates in series or in parallel

Anyhow.. you seem to want to complicate things a lot :P .. they are REALLY simple:

Initialization:
1) Get a physics engine, PhysX, Havok, Bullet, ODE.. you name it
2) Create 5 rigid bodies.. 4 wheels and 1 car body.
3) Connect the best you can, slider joint is the easiest, fastest and more performant solution

Game Loop:
- Check tyre to ground collision... if you have a collision solve adding forces to the tyre (using the physics engine built in functions) at the contact point. These include vertical, lateral, longitudinal forces and torques.. vertical is a spring, lat/lon and torques come from your tyre model.
- Check tyre's positions wrt car body.. add suspension spring and damper forces accordingly using the physics engine built in functions

done.. you have a very good starting point for a simple simulator with all the weight transfer already accounted for

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni


Anyhow.. you seem to want to complicate things a lot .. they are REALLY simple:



Maybe I just didn't know enough of them, and I tought they were difficult :)

Unfortunately the physics libraries are out of the equation right now (don't ask why :) )
I managed to knock together a simple rigid body dynamics with tensors.

Anyway, I got your point, and hopefuly will have time on the weekend to try it.
Thanks, again!

This topic is closed to new replies.

Advertisement