[ODE] Help with car simulation pls! :/
Craig Edwards
craig at bl33t.co.uk
Mon Apr 7 17:22:01 2003
> So what can you do to fix it? The first best thing is to add a ground
> plane and gravity, and be sure to set up at least a little bit of friction
> in your collision callback function. That should get your car to start
> moving in the direction you want it to. But it won't handle the stop
> problem. The way you fix that is, down at the very bottom of the code you
> copied in, where you set the FMax to 2.0, check dHinge2GetAngle1 to see if
> it returns a number outside of -0.5 and 0.5. If that's the case, set the
> FMax to 0 to unpower the joint, otherwise set it to 2.0 as planned. ODE
> just doesn't handle powering into stops very gracefully at present.
>
Thank you very much David! That explination was a great help.
Now that I have my car moving/steering.. I'm trying to tweak the settings,
but I'm running a little blind. One aspect I'm not to sure about is the
friction David talked about. Reading the docs seems to suggest that fdir1 is
calculated itself? But I tried to print out the values and got garbage which
seems to tell that its not. The docs talk about using dContactFDir1 and the
FDS to apply tyre friction, it mentions to set dContactFDir1 to the
direction of travel.. if my maths serves me correctly (dodgy ;p) if I get
the linear velocity of the body, and normalise it.. I should be able to
plug this into dContact.fdir yes? Or should I use the damping method which
has been discussed recently?
Another anomality seems to be with the gravity. Any higher value than
~(0, -0.05, 0) (i.e. if I try to use -9.81) and the car will just sink right
down. Either when the cars inital position is at (0, 0, 0) or if I drop the
car down onto the plane (tried, 10, 50, 100 in the y-axis). I must be
missing a concept here? Should the contact joint have a specific setting
here to stop it "sinking" ?
Also, how important is the chassis mass relative to the wheel mass? This
would help stopping the car tipping on it sides yes?
So far I've come up with these values (mix'd and matched from various other
source files)
contacts[c].surface.mode = dContactSlip1 | dContactSlip2 | dContactSoftERP |
dContactSoftCFM | dContactApprox1;
contacts[c].surface.mu = 250;
contacts[c].surface.slip1 = 0.1;
contacts[c].surface.slip2 = 0.1;
contacts[c].surface.soft_erp = 0.5;
contacts[c].surface.soft_cfm = 0.3;
Any tips anyone has would be greatly appericated.
Thank you,
Regards
Craig