Race Car Physics (again)
ive written a pacejka implementation a while back and pretty much stopped development for a while..
anyhow, i was messing with some of my old code and through much debugging, i discovered the main source of instability in my vehicle simulation engine was in the very core formula that ran it. the magic formula?
when i calculate lateral tire forces, in the situation where there is 0 slipratio, 0 camber angle and some force (~2.5kN), lateral forces were being produced.
the car wasn't moving -- wasnt turning -- for all practical purposes, wasn't even on. i figured it was just my code so I hit up that http://home.planet.nl/~monstrous/tutcar.html site, which I discovered was no longer online (though still on archive.org). I checked my magic formula against PHoRS again but couldnt see where I went wrong, so I went to http://www.racer.nl/reference/carphys.htm and peeked their rpacejka.cpp|.h files. Using the Default car's variables which I copied from the data directory, I replicated the conditions -- not in my engine but just to rest this single class. I ded in 0 camber, 0 slipangle, 0slipdegrees, with a pure downward directed force equal to about the weight of a 1/4 of a car on tire, and the exact same thing happened. lateral forces were being generated.
the result of either implementation (racer.nl's or my own) when plugged into my simulator results in the car accelerating ------->sideways, even from neutral, even when all variables are reset. this is really perplexing to me. is there some other sort of hack or formula or something i am supposed to use to kill lateral forces?
I believe the Pacejka formula (or is it the slip ratio calculation? I can never remember as it's been a while) becomes pretty unstable at low speeds, and in my Pacejka implementation I too got lateral acceleration, effectively the vehicle ocilated left to right.
I believe there is a paper by the society of automotive engineers called SAE950311 which will be of use, which effectively dampens the forces involved.
There's a discussion on this very subject here: http://forum.rscnet.org/showthread.php?t=193871
Hope it helps
I believe there is a paper by the society of automotive engineers called SAE950311 which will be of use, which effectively dampens the forces involved.
There's a discussion on this very subject here: http://forum.rscnet.org/showthread.php?t=193871
Hope it helps
Firstly, I'd like to say im glad it wasn't just me going crazy because I really felt like I was at the end of the line there for a second =)
As for the low speed calculations, however, I beleive SAE 950311 was the one on using that dampener and differential for the slip ratio; I actually have this implemented in my simulation and graph both the original and the dampened ratios. the dampened one by far looks better and is very stable, however even with it implemented, the car still moves -- it is as if the formula isn't centered around the origin, but shifted a bit. By this i mean that even if i hardcode a zero for slipratio, the output still is nonzero =( and since i pretty much just dump the output of the tire forces into my torque and force equations, the car responds accordingly.
here is my slipratio calculation, though I think the solution should lie in some other correction:
As for the low speed calculations, however, I beleive SAE 950311 was the one on using that dampener and differential for the slip ratio; I actually have this implemented in my simulation and graph both the original and the dampened ratios. the dampened one by far looks better and is very stable, however even with it implemented, the car still moves -- it is as if the formula isn't centered around the origin, but shifted a bit. By this i mean that even if i hardcode a zero for slipratio, the output still is nonzero =( and since i pretty much just dump the output of the tire forces into my torque and force equations, the car responds accordingly.
here is my slipratio calculation, though I think the solution should lie in some other correction:
max_v = MAX(MIN(fabs(rwheelav * cartype.wheelradius), fabs(velocity.x)), EPSILONV);slipratio = (rwheelav * cartype.wheelradius - velocity.x) / max_v;// oscillation period (experimental)float B = 0.91f, tau = 0.02f;float deltaW = (rwheelav*cartype.wheelradius - velocity.x) - max_v*diffSR;calculus.RungeKutta4(diffSR, deltaW/B, delta_t);// Disable as we pick upif( velocity.x > 5.0f ) tau = 0.0f;slipratio = diffSR + tau*deltaW;// Debuggingif(!grounded) slipratio=0;if(fabs(slipratio)<0.00001f) slipratio=0;if(slipratio>PI) slipratio=PI; if(slipratio<-PI) slipratio=-PI;InsertIntoDebugGraphs(0, slipratio*50, tehHeight*0.75f);
on a side note, just as a quick poll-
do people generally keep track of their car orientation as a set of three angles or as a vector with associated up vector? (or quaternions)?
do people generally keep track of their car orientation as a set of three angles or as a vector with associated up vector? (or quaternions)?
Quote:Original post by UthmanFor most types of physics simulation you should represent orientations using a matrix or quaternion rather than Euler angles. Note that a 'vector with associated up vector' is really just an alternate representation of the matrix form (or vice versa, depending on how you look at it).
on a side note, just as a quick poll-
do people generally keep track of their car orientation as a set of three angles or as a vector with associated up vector? (or quaternions)?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement