Possible bug with btCylinderShapeZ

marcimatz
Posts: 34
Joined: Fri Sep 18, 2009 5:41 am

Possible bug with btCylinderShapeZ

Post by marcimatz »

Hello,

I noticed a strange behaviour with the btCylinderShapeZ shape: please refer to the video sequence:

http://www.youtube.com/watch?v=q34xKjJw65A

and here a close-up and slow-motion of the first "jump":

http://www.youtube.com/watch?v=VYXnEYVzfY0

There are two similar vehicles: a red one and a blue one.
Each vehicle as two active joints that operate at opposite directions but same and constant velocities.
All masses, inertias (I explicitely set all inertias, i.e. they are not automatically calculated), friction coefficients, restitution coefficients are same for both vehicles. The only difference is that one has cylindrical wheels, and the other one has spherical wheels (but their inertias and other properties are exactly the same). All wheels have friction set to 1. Wheel diameters are 0.34 units.
Next to two wheels, each vehicle has a third contact point to the ground which is a small black sphere, with friction set to 0.

The whole world is internally scaled up by 10 to avoid jittering that happens with too small objects (i.e. to Bullet, the wheel diameters are 3.4 units).

The blue vehicle behaves normally, but the red vehicle starts to jumps for no reason and finally falls on its side. I have been wondering for hours why this happened, without finding an answer.
I tried to change the internal scaling of the world, but this didn't solve the problem.
Since the two vehicles are exactly the same except for the collision shape for the wheels, I conclude that the collision detection for cylinders causes my instabilities (I also tried to make the cylinders very thin to come very close to the 1 contact point to the ground that we have with the spheres, but the instability didn't disappear).

The scene hierarchy is displayed on the left hand side of the video.

Did anyone encounter the same type of instabilities, and how can I avoid them?

here some additional information:
Bullet version: 2.75
vehicle bodies and 2 wheels are btCylinderShapeZ
2 wheels and the 2 black sliding contacts to the ground are btSphereShape
the Wheel joints are btHingeConstraint with motors enabled, very high torque and constant velocity
The 2 black sliding contacts to the ground are linked to the bodies through a btGeneric6DofConstraint that has all axis locked
The floor is a btBoxShape

I suspect that the wheels made of btCylinderShapeZ sometimes create contacts to the ground (displayer in yellow in the video) that are not all aligned on a line, which can cause some forces to build-up, which finally brings the instabilities. Well, I cannot think of any other reason.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Possible bug with btCylinderShapeZ

Post by Erwin Coumans »

It is difficult to tell if it is a collision issue or constraint solver issue.

Did you leave the collision margin to its default?

Could you try to reproduce this in a Bullet constraint demo? Or even better, try to save it to a .bullet file using the latest Bullet 2.76 alpha, and attach a zipped file.
(see http://bulletphysics.org/mediawiki-1.5. ... ialization)

Thanks,
Erwin
marcimatz
Posts: 34
Joined: Fri Sep 18, 2009 5:41 am

Re: Possible bug with btCylinderShapeZ

Post by marcimatz »

Thanks for the quick reply Erwin.

Yes collision margin is kept to default. Ok, i will try to switch to the newest version and serialize the scene.
BTW if I use a simple mesh terrain (two triangles forming a square of the same x/y size as the ground box) instead of the ground box, then the instabilities disappear completely... but meshes might cause other problems and are not as fast
marcimatz
Posts: 34
Joined: Fri Sep 18, 2009 5:41 am

Re: Possible bug with btCylinderShapeZ

Post by marcimatz »

Hello Erwin,

Applying the latest Bullet source solved the problem! (went from 2.75 to 2.76)
Thanks!