Vehicle Controller Questions

eagletree
Posts: 28
Joined: Sun Jul 31, 2011 11:20 pm

Vehicle Controller Questions

Post by eagletree »

I have three questions concerning my implementation of the Vehicle controller. It's working quite well in some ways, but these items continue to plague my progress:

1. We have a model of a large truck similar to airport fuel haulers, only larger like a few military models. It requires two turning sets of front wheels. When I attempt to use 4 turning front wheels, I get an abort in stepSimulation. I'm wondering if more than 2 front wheels are supported and if anyone has demo'd it.

2. I find that while a large mass for our bigger vehicles makes them look good in the interaction with the level, it also keeps them from maintaining velocity while turning, the slowing is dramatic unless they are moving faster than what is realistic for giant trucks. I am curious if the mass I used exceeds some maximum recommend value. I used 2500 for a large 8 wheeled vehicle (which really should be 10 times that in kg), and 1500 for a medium sized 6x6 style military truck (again, very reduced from realistic kg). If I drop their mass, they work well (on a fast computer anyway), but I have to select very unrealistic masses to do so, and it shows a bit when they go over hills and bumps, and jump like a sports car. Are their maximum mass recommendations?

3. The third problem appears to be related to the second. I've had very jerky simulation if the mass is high, if I spawn at least 3 vehicles and if those vehicles have more than 4 wheels. I can spawn quite a few 4 wheel vehicles without lagging my slower test system but just 3 multi-rear wheel vehicles with high mass (either) tend to make it sub-production smoothness even on my dual Xeon quad. I can get rid of the problem by using a stepSimulation hack that I'm certain is foolish (multiple calls to stepSimulation with low substeps but then the rest of the physics goes bad). I'd like to find out what is causing it. I guess the question is, are vehicles with many wheels and high mass exceeding the capability of the stock controller?

Thanks
Skuzz
Posts: 11
Joined: Wed Aug 25, 2010 12:57 am

Re: Vehicle Controller Questions

Post by Skuzz »

What values are you using for the various suspension settings?

I haven't tried > 4 wheels yet.

I'm getting brilliant results for an off road type buggy with these values:

(using a box as a collision object for now)
overall width = 2.4
overall height = 1
overall length = 3.2
mass = 2200
wheelRadius = .5
susLength = 0.8
maxSuspenstionTravel = suslen
susConnect = .2 (connection point inside the/a collision object, effectively reducing the available suspension length)
suspStiffness = 30.0
dampingCompression = 2.0
dampingRrelaxation = 3.0
maxSuspenstionForce = 50000
eagletree
Posts: 28
Joined: Sun Jul 31, 2011 11:20 pm

Re: Vehicle Controller Questions

Post by eagletree »

Skuzz wrote:What values are you using for the various suspension settings?

I haven't tried > 4 wheels yet.

I'm getting brilliant results for an off road type buggy with these values:

(using a box as a collision object for now)
overall width = 2.4
overall height = 1
overall length = 3.2
mass = 2200
wheelRadius = .5
susLength = 0.8
maxSuspenstionTravel = suslen
susConnect = .2 (connection point inside the/a collision object, effectively reducing the available suspension length)
suspStiffness = 30.0
dampingCompression = 2.0
dampingRrelaxation = 3.0
maxSuspenstionForce = 50000
It's probably comparing apples and oranges but is my parameter file set up for a sci-fi truck, 8 wheels 2 steering. At the right mass, it slows to a crawl when steered. I have the mass way down right now. This is an excerpt from my vehicle configuration file but the names are close enough to see what they relate to in Bullet.

Code: Select all

        Vehiclename sonofhades
        filename media/sonofhades/soh.obj
        fwlfilename media/sonofhades/sohwf.obj
        fwrfilename media/sonofhades/sohwf2.obj
        rwlfilename media/sonofhades/sohwb.obj
        rwrfilename media/sonofhades/sohwb2.obj
        numfwheels 2
        numrwheels 6
        collisionsizeX 6.25
        collisionsizeY 2.5
        collisionsizeZ 12.3
        enginepowerincr 290
        enginepowermax 2900
        brakeforceincr 0.2
        brakeforcemax 8
        steeringincr 0.009
        steeringmax 0.35
        fwheelradius 2.0
        fwheelwidth 0.6
        rwheelradius 2.0
        rwheelwidth 0.6
        wheelfriction 20
        suspensionstiffness 100.0
        suspensiondamping 11.3
        suspensioncompression 4.4
        rollinfluence 0.1
        mass 500
        suspensionrestlength 0.5
        connectionheight -0.5
        axleconnX -1
        axleconnY 0
        axleconnZ 0
        wheeldirectionX 0
        wheeldirectionY -1
        wheeldirectionZ 0
        wheelposx 4.5
        wheelpos1z 8.5
        wheelpos2z -0.7
        wheelpos3z -6.0
        wheelpos4z -13.1
Skuzz
Posts: 11
Joined: Wed Aug 25, 2010 12:57 am

Re: Vehicle Controller Questions

Post by Skuzz »

I tried those vehicle settings, if I use these settings I get a drivable vehicle, but I also use the code tweak below, I can use a mass up to about 25000 without the sim exploding, it steers fine though.


The default spring response is abrupt and can cause or exaggerate jittering in the simulation.

In btRaycastVehicle.cpp about line 433

After:

btScalar length_diff = (susp_length - current_length);

Add this:

length_diff *= length_diff / susp_length;


The result is more like variable springs, and really does settle things down a lot.

Red is the default spring response, Green is with the extra line of code.

I beef up the the suspension stiffness and maxsuspensionforce and the result is better in my opinion.


With 2 wheel steering it does slow down when turning, but it's not too bad. I suspect the same is true with all trucks (more so non-articulated) with a large amount of wheels. They'd create some drag along the length when turning I'm sure.

4 wheel steering works much better! :)

Dimensions as per yours.

mass 25000
maxSuspensionForce 250000
suspStiffness 50
compressionDamping 1
relaxationDamping 3

Without my suspension code tweak these settings will make the vehicle dance on the spot, with it, it's drivable!
You do not have the required permissions to view the files attached to this post.
Last edited by Skuzz on Fri Sep 02, 2011 2:30 pm, edited 1 time in total.
eagletree
Posts: 28
Joined: Sun Jul 31, 2011 11:20 pm

Re: Vehicle Controller Questions

Post by eagletree »

Thanks very much for the very detailed response, it appears to address all of the issues. I will try this today.
eagletree
Posts: 28
Joined: Sun Jul 31, 2011 11:20 pm

Re: Vehicle Controller Questions

Post by eagletree »

I thought I should add to this thread concerning number 3 in the OP. Too many threads are open ended and I'd guess that for new people, it looks like bullet has problems that it doesn't. As I'm sure experts knew, this was not a bullet issue, but a noob issue of having the camera rotation and positioning occur prior to the stepSimulation rather than with the render code. Very dumb oversight in one routine out of many that were modified correctly when I added physics in. :oops: Ts were not crossed.

All my vehicle controller code is working smoothly with appropriate mass based on these solutions, though I've yet to attempt 4 wheel steering again. I plan to mess with that soon.