[ODE] Setting up two objects with two seperate centre of gravities

Tristan McMillan tmcmillan at tmiconsult.co.za
Wed Sep 13 01:50:58 MST 2006


Hi ODE Community

This question has had me stumped for quit a while now.

What I'm trying to do is create a truck and trailer combination. So I've
created two bodies:
1) Body 1 is connected to a Trimesh geometry which represents the horse
2) Body 2 is just a box.

However the problem comes when I try to setup the mass and inertias of
each body.

I currently do this using the following function.
Horse (Trimesh):

dBodySetPosition( horseBody, horseCG[0], horseCG[1], horseCG[2] ); 
dMassSetParameters(&mM,mass,CG[0],CG[1],CG[2],Ix,Iy,Iz,0.0,0.0,0.0); 

Trailer (Box)

dBodySetPosition( trailerBody,trailerCG[0],trailerCG[1],trailerCG[2] );
dMassSetBox( &mM, DENSITY, length,width,height);

Where the CG positions are all relative to a global reference system. 

This however always gives an error for the horse setup:

ODE Message 2: center of mass inconsistent with mass parameters in
dMassCheck() File mass.cpp Line 68

ODE Message 2: center of mass inconsistent with mass parameters in
dMassCheck() File mass.cpp Line 68

Is this the right way to set the mass of a trimesh body?

I've checked the wiki and found that the cg of each body should always
be at the origin, but then how do you place the other body (trailer)
relative to this?

BTW: The trailer is connected to the horse using a universal joint.

Thanks
Tristan





More information about the ODE mailing list