Problems with bouncing vehicle on ground

Gickl
Posts: 33
Joined: Tue Jun 05, 2012 8:43 am

Problems with bouncing vehicle on ground

Post by Gickl »

Hi,

i want to simulate several robots on static terrain. the picture shows a simple example: a robot consisting of a box and 4 cylinders as wheels (.osg-models). the terrain is assembled from several components (ramps, ground, hole, etc (also .osg-models)). the wheels have a diameter of 0.2 meter.
i think this is nothing special. but i can't get the simulation to work perfectly without curious effects.

at the moment i use btBvhTriangleMeshShapes for the static terrain models and btConvexTriMeshCollisionShapes for the dynamic robot. this leads to different cases depending on the collision margins:

1) leave margins unchanged:
--> robot wheels are hovering above the ground. but the robot drives correctly, just a few centimeters above the ground.

2) set margin to 0.0:
--> wheels are on the ground. but there are curious collisions with the ground and so the wheels are bouncing without cause.

3) set margin to small value (0.001):
--> wheels are almost on the ground and curious bouncing is weaker

in every case the robot is not standing still. the wheels are moving very very slowly although they should not move in any direction because there are no forces or anything else affecting the wheels...



so these are the problems i try to solve. i read about the internal edge problem and added the following code at the beginning of .cpp file where i construct the rigid bodies:

Code: Select all

static bool CustomMaterialCombinerCallback(btManifoldPoint& cp, const btCollisionObjectWrapper* colObj0,int partId0,int index0,const btCollisionObjectWrapper* colObj1,int partId1,int index1)
{
   btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1);
   return true;
}

extern ContactAddedCallback      gContactAddedCallback;
then i used the following code to add the callback to the body:

Code: Select all

gContactAddedCallback = CustomMaterialCombinerCallback;
...
_body->setCollisionFlags(_body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
btTriangleInfoMap* triangleInfoMap = new btTriangleInfoMap();			
btGenerateInternalEdgeInfo(dynamic_cast<btBvhTriangleMeshShape*>(_shape), triangleInfoMap);	
But that doesn't help. i can't see an effect anyway.

the only way to get the simulation to work almost correctly is to use btConvexTriMeshCollisionShapes for the ground, to set the margin of the dynamic shapes (wheels) to 0.0 or 0.01 and to scale the whole scene with a factor of 5.0 for example. but then the robot is still moving very very slowly and not standing completely still. so this might be a solution if there is no other way. but it is not very satisfying and i can't imagine that there is no other way.

i do not have any further ideas what i can do to solve the problems of the bouncing wheels and the very slow movement and i hope someone can help me with that and tell me how to get such a simple simulation to work.

thank you in advance
Gickl
You do not have the required permissions to view the files attached to this post.
Last edited by Gickl on Wed Jul 03, 2013 6:27 pm, edited 1 time in total.
Gickl
Posts: 33
Joined: Tue Jun 05, 2012 8:43 am

Re: Problems with bouncing vehicle on ground

Post by Gickl »

i forgot to say that the white wireframe shapes in the picture are the collision shapes displayed with openscenegraph
Gickl
Posts: 33
Joined: Tue Jun 05, 2012 8:43 am

Re: Problems with bouncing vehicle on ground

Post by Gickl »

no ideas or suggestions?