rec.autos.simulators

Car Physics : Tyres as Spring / Dampers

Ashley McConnel

Car Physics : Tyres as Spring / Dampers

by Ashley McConnel » Thu, 09 May 2002 04:28:40

Hi Folks,

I am trying to model my tyres as springs / dampers, but I am having big
problems with stability :(  I have upped my frequency to 1000Hz, but still
no difference.

Here is what I do: -

1.  Add a force to the car at its CoG representing the weight
2.  Allow the car to sink into the ground
3.  Calculate the upward force based on the distance the tyre has squashed
(i.e. how far it has sank into the ground)
4.  Calculate a damping force based on the vertical velocity of the tyre.

I am using a Spring value of 60000 and a damping value of 6000

When I turn a corner it starts bouncing terribly and soon goes out of
control.  If you want to see what happens have a look at
http://www.racesimcentral.net/~ashley.mcconnell/demo/demo011.zip (use q/a/o/p
and 1/2 to change gear).  WARNING - it aint pretty, and there are some
horrible keyboard issues to be resolved :)

Here is the code in question (horribly formatted in the pasting process) : -

void CTyre::CalcFz()
{
 groundReaction = Vector3(0.0f,0.0f,0.0f);
 Vector3 groundReactionTYRE;

 //Get the distance that the tyre has sunk into the ground
 height = GetDistanceFromPatchToGround();

 //Check if our force has made the sign change (it shouldnt)
 if ((lastTyreVel) && (velTyreTyre.y<0)) {
  velTyreTyre.y = 0;
 }

 if ((!lastTyreVel) && (velTyreTyre.y>0)) {
  velTyreTyre.y = 0;
 }

 if (velTyreTyre.y>0) {
  lastTyreVel = true;
 }
 else {
  lastTyreVel = false;
 }

 //Reset the tyre force to zero
 tyreForceTYRE.z = 0.0f;

 if (height<0){
      groundReaction.y = (tyrestiffness * -height);

      //Do a little damping
      groundReaction.y += (velTyreTyre.y * -tyredamper);

      tmpDampingForce = (velTyreTyre.y *-tyredamper);
 }
 else {
      //We are off the ground
      groundReaction.y = 0.0f;
      tmpDampingForce = 0.0f;
 }

 tyreForceTYRE.add(groundReactionTYRE);
 FzKN = tyreForceTYRE.z / 1000.0f;

Can anyone see anything obvious that I am doing wrong?

Ash
http://www.racesimcentral.net/

Sebastien Tixie

Car Physics : Tyres as Spring / Dampers

by Sebastien Tixie » Fri, 10 May 2002 00:08:52

hello,

your values seems too smal, here is the values i used for suspensions
in our sim for dirt ( dirt suspensions are softer than tarmac ones ),
tire spring rate and damping should be bigger , no ?

front spring rate 50k N/m
rear spring rate 25k N/m
front compression rate 600k N/m/s
rear compression rate 400k N/m/s
front release rate 650k N/m/s
rear release rate 450k N/m/s

hope it's helps

Remco Moe

Car Physics : Tyres as Spring / Dampers

by Remco Moe » Fri, 10 May 2002 00:19:05

On Tue, 7 May 2002 20:28:40 +0100, "Ashley McConnell"

I've no idea if I'm right with my observations, but hereby just some
comments....

Since height is negative, the  groundReaction.y will always
be possitive. (I assume tyrestiffnes is possitive)

I assume velTyreTyre.y is negative, after all, the height is negative.
As a result, instead of damping, you're adding to  groundReaction.y.

Your source could use some comments, BTW... <g>

Cheers!

Remco

Ashley McConnel

Car Physics : Tyres as Spring / Dampers

by Ashley McConnel » Fri, 10 May 2002 00:55:16

Hmm, I think I am damping on the way up (i.e. the tyre is moving upwards),
but on the way down (into the ground) I *add* to the force (very bad!).  I
cant wait to get home and give it a try :)

You are a Saint - St. Remerooo :)

Its "experimental" code, i'll rewrite it to look sensible when it works :)
Dont make me dig out your source code..... <BG>

Thanks!
Ash

Ruud van Ga

Car Physics : Tyres as Spring / Dampers

by Ruud van Ga » Fri, 10 May 2002 01:05:02

On Wed, 08 May 2002 17:08:52 +0200, Sebastien Tixier


>hello,

>>I am using a Spring value of 60000 and a damping value of 6000

>your values seems too smal, here is the values i used for suspensions
>in our sim for dirt ( dirt suspensions are softer than tarmac ones ),
>tire spring rate and damping should be bigger , no ?

>front spring rate 50k N/m
>rear spring rate 25k N/m
>front compression rate 600k N/m/s
>rear compression rate 400k N/m/s

Are you sure? Generally my damper rates are softer (N/m/s) than
suspension rates. I believe even the champ car used about 8000-11000
N/m/s.

Ruud van Gaal
Free car sim: http://www.racer.nl/
Pencil art  : http://www.marketgraph.nl/gallery/

Ruud van Ga

Car Physics : Tyres as Spring / Dampers

by Ruud van Ga » Fri, 10 May 2002 01:25:07

Hi Ash,

I had quite some trouble getting things to work reliably until I
switched to implicit integration for the wheel velocity.
I don't know exactly how it went, but you can take F=m*a and fill in
'a' from the formulae you're using. Then, instead of using the CURRENT
velocity of the wheel, you use a FUTURE velocity of the wheel, and try
to work out the formula then.

See Baraff's paper on implicit integration for some info (I'm sure
you've read it ;-) ).

...

Don't you mean "if(lastTyreVel>0&&velTyreTyre.y<0)" ?
What you do here is just check if lastTyreVel is not 0, which is
almost always true. But oh, it may be the *sign* of the velocity. In
that case, probably works, just a bad variable name. ;-)

You can perhaps add these two tests that do nearly the same thing by
using the real last tyre velocity and:

if(lastTyreVel*velTyreTyre.y<0)
{
  velTyreTyre.y=0;

Since if the product<0, then one is positive, and the other is
negative, which means velocity reversal.

And here then just make lastTyreVel=velTyreTyre.y. BTW If that last
postfix 'Tyre' means 'in tire coordinates', perhaps you can name it TC
for example. Not that I want to interfere with your naming scheme, but
I use postfixes to indicates the coordinate system, like WC/TC/BC.
Reads a little easier than seeing 'Tyre' twice.

Make sure the signs are ok. But it probably would be ok too if they
weren't, I think (not physically, just that it wouldn't not crash).

I'd print out the wheel height vs. time. You might notice that it's
bumping up and down. You might call it wheel hop, but also integration
errors. ;-)

I had this problem, especially when using stiff springs. The tire
would get perhaps half of its intended grip, because it was (and
perhaps still is! :) ) bouncing a bit on the ground.
The implicit integration helps very much here. I'll copy it from
racer/lib/rwheel.cpp:

// Calc total vertical force (spring)
forceNonDamper=...
// forget damper for vel.y
forceNonDamper.y-=susp->GetForceDamper()->y;
// Calc explicit part
acceleration.y=forceNonDamper.y/GetMass();
oldVelocity=velocity;

// Implicit new velocity
velocity.y = (velocity.y+RR_TIMESTEP*forceNonDamper.y/GetMass()) /
  (1.0+susp->GetBumpRate()/GetMass()*RR_TIMESTEP);

// Explicit translation
translation.y=(oldVelocity.y+0.5f*acceleration.y*RR_TIMESTEP)*RR_TIMESTEP;

position.y+=translation.y;
---

Now that I look at it, it seems strange to calculate the new velocity
implicitly, but explicitly update position.y (through translation.y).
Also, where did forceDamper go?

Oh oh, exploding head alert! ;-)
Sometimes it's a wonder that sims actually feel like it's real. :)

Ruud van Gaal
Free car sim: http://www.racer.nl/
Pencil art  : http://www.marketgraph.nl/gallery/

Sebastien Tixie

Car Physics : Tyres as Spring / Dampers

by Sebastien Tixie » Sat, 11 May 2002 14:44:36



>On Wed, 08 May 2002 17:08:52 +0200, Sebastien Tixier

>>hello,

>>>I am using a Spring value of 60000 and a damping value of 6000

>>your values seems too smal, here is the values i used for suspensions
>>in our sim for dirt ( dirt suspensions are softer than tarmac ones ),
>>tire spring rate and damping should be bigger , no ?

>>front spring rate 50k N/m
>>rear spring rate 25k N/m
>>front compression rate 600k N/m/s
>>rear compression rate 400k N/m/s

>Are you sure? Generally my damper rates are softer (N/m/s) than
>suspension rates. I believe even the champ car used about 8000-11000
>N/m/s.

hmmm... maybe i have a magic factor somewhere ,o)
I have to check that , thanks notice this error.
I have to check the code now ;o)
Ruud van Ga

Car Physics : Tyres as Spring / Dampers

by Ruud van Ga » Sun, 12 May 2002 02:17:22

On Fri, 10 May 2002 07:44:36 +0200, Sebastien Tixier


>>>front spring rate 50k N/m
>>>rear spring rate 25k N/m
>>>front compression rate 600k N/m/s
>>>rear compression rate 400k N/m/s

>>Are you sure? Generally my damper rates are softer (N/m/s) than
>>suspension rates. I believe even the champ car used about 8000-11000
>>N/m/s.

>hmmm... maybe i have a magic factor somewhere ,o)
>I have to check that , thanks notice this error.
>I have to check the code now ;o)

Lol, perhaps k is defined as '10' in your code. ;-)

Ruud van Gaal
Free car sim: http://www.racer.nl/
Pencil art  : http://www.marketgraph.nl/gallery/


rec.autos.simulators is a usenet newsgroup formed in December, 1993. As this group was always unmoderated there may be some spam or off topic articles included. Some links do point back to racesimcentral.net as we could not validate the original address. Please report any pages that you believe warrant deletion from this archive (include the link in your email). RaceSimCentral.net is in no way responsible and does not endorse any of the content herein.