Re: Suspension correction
David Savinkoff <[email protected]> Tue, 4 Apr 2017 19:13:23 -0600 (MDT)
| Newsgroups | gmane.games.torcs.general |
|---|---|
| Message-ID | <1749138475.4202085.1491354803357.JavaMail.zimbra@mailid.telus.net> |
----- Bernhard Wymann wrote:
> Hi David
>
> > A real car has the springs preloaded (lest you have loose suspension).
>
> Sure, but this just shifts the point of eqilibrium, the spring is still
> a spring (at least for the linear springs we model).
>
> > I've been following the commits to TORCS and heard about
> > forces due to inertia and mass acting on the axle.
> > If TORCS' formulas are calculated in a proper and generalized
> > way, the spring may have tensile forces (negative values) at times.
>
> The "if" statement which your patch removes does exactly deal with that.
> The spring can just generate forces in one direction, if it is fully
> extended it is just loose. Depending on the ride height/suspension
> course setup this does not happen, but if it happens we are prepared.
>
Good.
> > This patch does the bounds checking for negative values where
> > the tire contacts the road, and not where damping may act
> > against the spring.
> >
> > The car is more controllable on dirt tracks, and has no new
>
> This is no argument, we could just replace it all with a constant force
> and handling would be great, but the model would be dead wrong anyway.
>
> The second part of your change is identical (semantically) to the
> previous code, think about it again:
>
> 1.3.8-test1:
> tdble internalForce = springForce(susp) + damperForce(susp);
> if (internalForce <= 0.0f) {
> susp->force = 0.0f;
> } else {
> susp->force = internalForce * susp->spring.bellcrank;
> }
>
> Yours:
> susp->force = (springForce(susp) + damperForce(susp)) *
> susp->spring.bellcrank;
> if (susp->force < 0.0f)
> susp->force = 0.0f;
>
> So whatever you have felt must be something not contained in this patch.
> Agreed?
It appears that keeping negative spring values in the first part
of this patch is what I felt.
>
> > problems that I could find. Thus, I figured this is an improvement.
> >
> > On a real car, the spring may be preloaded so that it never gets
> > a tensile force on it (no need for negative bounds checking).
>
> Agreed, but if somebody gets the parameters of the cars wrong I do not
> want the simulation to "explode", otherwise you have to implement
> validations in some other places.
>
> Kind regards
>
> Bernhard
Thank you for the explanations.
I just conducted an experiment on Dirt-2 and car1-trb1 with
a printf() added in torcs/src/modules/simu/simuv2/susp.cpp
/*
* get spring force
*/
static tdble springForce(tSuspension *susp)
{
tSpring *spring = &(susp->spring);
tdble f;
/* K is < 0 */
f = spring->K * (susp->x - spring->x0) + spring->F0;
if (f < 0.0f) {
/***/ printf("%f",f);
// Compression spring, so the force can never change the sign.
f = 0.0f;
}
return f;
}
Numbers in the range of -7000 are printed when the car is jumped in the air.
Please check to see if this is reasonable.
Does car1-trb1 have loose suspension, or is something else happening?
People that make torcs cars need to know if their setup is what they
intended.
Sincerely,
David Savinkoff
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot