[ODE] problems with vectors, I think
Alex Hetu
alexhetu at videotron.ca
Mon Dec 8 18:32:00 MST 2003
If that can help, I know that ODE often crashed on me when some objects had
very little mass with/or a small volume. I don't think i still have the
numbers for it, but i used to run tests to determine when ODE would explode
or even crash. I tried different sizes and masses on spheres and cubes and I
clearly remember ODE exploding as soon as a body with a very small mass (or
small volume, or both) would collide with something... I remember slightly
increasing (ex: from 0.2 to 0.21) the mass on those bodies and then see ODE
working perfectly again. I noticed that you're assigning a small mass to
your sphere, i suggest you try to scale up those numbers and see for
yourself if it works. It may sound bogus, but it did work for me once so...
;)
Alex
-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of
Martin C. Martin
Sent: Monday, December 08, 2003 1:40 PM
To: John Sparks
Cc: ode at q12.org
Subject: Re: [ODE] problems with vectors, I think
If nobody replies to your post, that means they can't help you.
It might help if you track the problem down a little more. The fact
that you have the entire source is a big help here. Find out what
exactly is causing these messages, my guess is, well, some dMass
structure has a mass <= 0 and either that same dMass or a different one
has a messed up inertia tensor. Find out which ones, then set a
breakpoint when the values change. Where does the non-positive mass
come from? Is the dMass not being initialized? Does it get
accidentally freed and overwritten? Does it get overwritten because
some other array somewhere goes over bounds? The possibilities are
endless, but aren't too hard to track down with a little investigation.
Cheers,
Martin
John Sparks wrote:
> I am trying to run the code posted on 6/1/2003 by Shaul Kedem. I
> originally had it working but now I get errors.
>
> "mass must be > 0" from mass.cpp
> "inertia must be positive definite" from ode.cpp
>
> I'm using ODE 0.035 and have included the code below. Any ideas as to
> why it is doing this?
>
> Thanks,
> John
>
> #include "ode/ode.h"
>
> dWorldID aWorld ;
> dBodyID aBody;
> dSpaceID aSpace;
> dGeomID aSphere;
> dGeomID aGround;
> dJointGroupID grpContacts;
>
> static void nearCallback (void *data, dGeomID o1,
> dGeomID o2)
> {
> int i;
>
> dBodyID b1 = dGeomGetBody(o1);
> dBodyID b2 = dGeomGetBody(o2);
> if (b1 && b2 && dAreConnectedExcluding
> (b1,b2,dJointTypeContact))
> {
> return;
> }
>
> dContact contact[4]; // up to 4 contacts per box-box
> for (i=0; i<4; i++) {
> contact[i].surface.mode = dContactBounce |
> dContactSoftCFM |dContactSoftERP;
> contact[i].surface.mu = dInfinity;
> contact[i].surface.mu2 = 0;
> contact[i].surface.bounce = 0.1;
> contact[i].surface.bounce_vel = 0.1;
> contact[i].surface.soft_cfm = 0.001;
> contact[i].surface.soft_erp = 1.0;
> }
> int numc = dCollide
> (o1,o2,4,&contact[0].geom,sizeof(dContact));
> if (numc) {
>
> dMatrix3 RI;
> dRSetIdentity (RI);
> const dReal ss[3] = {1.0,1.0,1.0};
> for (i=0; i<numc; i++) {
> dJointID c = dJointCreateContact
> (aWorld,grpContacts,&contact[i]);
> dJointAttach (c,b1,b2);
> }
> }
> }
>
>
> void main ( void )
> {
> int count = 0;
> aWorld = dWorldCreate();
> dWorldSetGravity (aWorld,0,0,-0.5);
> dWorldSetCFM (aWorld,1e-5);
> aSpace = dHashSpaceCreate (0);
> dMass m;
> aBody = dBodyCreate (aWorld);
> dBodySetPosition ( aBody,0,0,10 );
> dMassSetSphere (&m,0.2,1.0f );
> aSphere = dCreateSphere ( aSpace, 1.0f );
> dBodySetMass ( aBody,&m );
> dGeomSetBody ( aSphere,aBody );
> aGround = dCreatePlane ( aSpace,0,0,1,0 );
> grpContacts = dJointGroupCreate (0);
> dReal *pos;
>
> do
> {
> dJointGroupEmpty (grpContacts);
> dSpaceCollide (aSpace,0,&nearCallback);
> dWorldStep (aWorld, 0.1);
> pos = (dReal *)dGeomGetPosition(aSphere);
> printf ( "%f,%f,%f\n",pos[0],pos[1],pos[2] );
>
> // use this sleep to see what happens, you can safely remove it
> _sleep(10);
>
> if ( pos[2] < 1.0 )
> count ++;
>
> // to get the rotation use
> dGeomGetRotation(aSphere);
> } while ( count < 20 ) ;
>
> dJointGroupDestroy (grpContacts);
> dSpaceDestroy(aSpace);
> dWorldDestroy (aWorld);
> dCloseODE();
> }
>
> ----- Original Message -----
> From: John Sparks <mailto:pnk4jss at ufl.edu>
> To: ode at q12.org <mailto:ode at q12.org>
> Sent: Friday, December 05, 2003 3:52 AM
> Subject: mass/inertia problems?
>
> I am trying to run the code posted on 6/1/2003 by Shaul Kedem. I
> originally had it working but now I get errors.
>
> "mass must be > 0" from mass.cpp
> "inertia must be positive definite" from ode.cpp
>
> I'm using versioni 0.035 and have included the code below. Any
> ideas as to why it is doing this?
>
> Thanks,
> John
>
> #include "ode/ode.h"
>
> dWorldID aWorld ;
> dBodyID aBody;
> dSpaceID aSpace;
> dGeomID aSphere;
> dGeomID aGround;
> dJointGroupID grpContacts;
>
> static void nearCallback (void *data, dGeomID o1,
> dGeomID o2)
> {
> int i;
>
> dBodyID b1 = dGeomGetBody(o1);
> dBodyID b2 = dGeomGetBody(o2);
> if (b1 && b2 && dAreConnectedExcluding
> (b1,b2,dJointTypeContact))
> {
> return;
> }
>
> dContact contact[4]; // up to 4 contacts per box-box
> for (i=0; i<4; i++) {
> contact[i].surface.mode = dContactBounce |
> dContactSoftCFM |dContactSoftERP;
> contact[i].surface.mu = dInfinity;
> contact[i].surface.mu2 = 0;
> contact[i].surface.bounce = 0.1;
> contact[i].surface.bounce_vel = 0.1;
> contact[i].surface.soft_cfm = 0.001;
> contact[i].surface.soft_erp = 1.0;
> }
> int numc = dCollide
> (o1,o2,4,&contact[0].geom,sizeof(dContact));
> if (numc) {
>
> dMatrix3 RI;
> dRSetIdentity (RI);
> const dReal ss[3] = {1.0,1.0,1.0};
> for (i=0; i<numc; i++) {
> dJointID c = dJointCreateContact
> (aWorld,grpContacts,&contact[i]);
> dJointAttach (c,b1,b2);
> }
> }
> }
>
>
> void main ( void )
> {
> int count = 0;
> aWorld = dWorldCreate();
> dWorldSetGravity (aWorld,0,0,-0.5);
> dWorldSetCFM (aWorld,1e-5);
> aSpace = dHashSpaceCreate (0);
> dMass m;
> aBody = dBodyCreate (aWorld);
> dBodySetPosition ( aBody,0,0,10 );
> dMassSetSphere (&m,0.2,1.0f );
> aSphere = dCreateSphere ( aSpace, 1.0f );
> dBodySetMass ( aBody,&m );
> dGeomSetBody ( aSphere,aBody );
> aGround = dCreatePlane ( aSpace,0,0,1,0 );
> grpContacts = dJointGroupCreate (0);
> dReal *pos;
>
> do
> {
> dJointGroupEmpty (grpContacts);
> dSpaceCollide (aSpace,0,&nearCallback);
> dWorldStep (aWorld, 0.1);
> pos = (dReal *)dGeomGetPosition(aSphere);
> printf ( "%f,%f,%f\n",pos[0],pos[1],pos[2] );
>
> // use this sleep to see what happens, you can safely remove it
> _sleep(10);
>
> if ( pos[2] < 1.0 )
> count ++;
>
> // to get the rotation use
> dGeomGetRotation(aSphere);
> } while ( count < 20 ) ;
>
> dJointGroupDestroy (grpContacts);
> dSpaceDestroy(aSpace);
> dWorldDestroy (aWorld);
> dCloseODE();
> }
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode
More information about the ODE
mailing list