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.btinternet.com/~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.siroccoracing.com
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
front release rate 650k N/m/s
rear release rate 450k N/m/s
hope it's helps
On Tue, 7 May 2002 20:28:40 +0100, "Ashley McConnell"
<[email hidden]> wrote:
I've no idea if I'm right with my observations, but hereby just some
comments....
> if (height<0){
> groundReaction.y = (tyrestiffness * -height);
Since height is negative, the groundReaction.y will always
be possitive. (I assume tyrestiffnes is possitive)
>
> //Do a little damping
> groundReaction.y += (velTyreTyre.y * -tyredamper);
I assume velTyreTyre.y is negative, after all, the height is negative.
As a result, instead of damping, you're adding to groundReaction.y.
> tmpDampingForce = (velTyreTyre.y *-tyredamper);
> }
Your source could use some comments, BTW... <g>
Cheers!
Remco
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
Quoted text (7 lines)
> > > > //Do a little damping > > groundReaction.y += (velTyreTyre.y * -tyredamper); > > I assume velTyreTyre.y is negative, after all, the height is negative. > As a result, instead of damping, you're adding to groundReaction.y. >On Wed, 08 May 2002 17:08:52 +0200, Sebastien Tixier
<stixier@wanadoo[NO_SPAM].fr> wrote:
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/
Quoted text (12 lines)
>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/sHi 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 ;-) ).
...
> //Check if our force has made the sign change (it shouldnt)
> if ((lastTyreVel) && (velTyreTyre.y<0)) {
> velTyreTyre.y = 0;
> }
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. ;-)
> if ((!lastTyreVel) && (velTyreTyre.y>0)) {
> velTyreTyre.y = 0;
> }
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.
> if (velTyreTyre.y>0) {
> lastTyreVel = true;
> }
> else {
> lastTyreVel = false;
> }
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/
Quoted text (13 lines)
>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 6000Quoted text (10 lines)
> //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);On Wed, 08 May 2002 16:05:02 GMT, [email hidden] (Ruud van Gaal)
wrote:
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)
Quoted text (19 lines)
>On Wed, 08 May 2002 17:08:52 +0200, Sebastien Tixier ><stixier@wanadoo[NO_SPAM].fr> wrote: > >>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.On Fri, 10 May 2002 07:44:36 +0200, Sebastien Tixier
<stixier@wanadoo[NO_SPAM].fr> wrote:
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/


































