[ODE] AMD x86_64 dMassCheck() and bNormalizationResult errors (solved?)

Funky Fred funkyfredmale at hotmail.com
Mon Nov 19 23:22:51 MST 2007

Ok, I figured out the cause of the error, and a way around it, but I'm not sure what changed between my old build and this one (I think I was using ode 0.6, which may have been more a factor than the would 32 -> 64 bit).

The problem wasn't zero mass, it was zero inertia. The mass would get set just fine whether i do:
dmass.mass = mass 
dMassAdjust( &dmass, mass )

Keep in mind the first gave me "Inertia must be positive definite" error (see first post).
I then changed to the second (dMassAdjust), which causes this:
  dReal scale = newmass / m->mass;
  m->mass = newmass;
  for (int i=0; i_I(i,j) *= scale;

To put in a bunch of NaN's for m->_I, but makes the positive definite error go away ;)
this results in:
		dMULTIPLYADD0_331 (body[i]->avel,invI + i*12,body[i]->tacc);
putting in a bunch of NaN's for avel. And down we go the rabbit hole...

The question of where I found the tutorial that led me to thinking the code in previous posts was OK is still open (or whether it was just my own random hacking)

Also, why have a SetMass function if it doesn't make any sense without also adjusting the inertia?? But I leave the API design up to the gods of ODE :P
I changed the code in the post below to:

    dMass dmass;
    dMassSetZero( &dmass );
    dMassSetSphere( &dmass, mass / 3.14159, 1 ); //as close to point mass as I'm going to get. A reasonable default without knowing the shape.
    dBodySetMass( bodies[name], &dmass );
    return true;

And everything worked fine.
Still unsure whether this should have been a clear and obvious bug in my code, or something misleading that happened with an ODE update (maybe both?) - and I'm certainly not going to lose sleep over it. It works now, and more importantly, it makes sense.

A big thanks to Bram for all the help! Open-Source software & community at it's best.


> Date: Mon, 19 Nov 2007 07:26:11 -0800
> From: b.stolk at gmail.com
> To: funkyfredmale at hotmail.com
> CC: ode at ode.org
> Subject: Re: [ODE] AMD x86_64 dMassCheck() and bNormalizationResult errors
> On Nov 18, 2007 12:08 AM, Funky Fred <funkyfredmale at hotmail.com> wrote:
> bool PhysicsEngine::setMass( const string& name, double mass )
> {
>    ...
>    dMass dmass;
>    dMassSetZero( &dmass );
>    //dMassAdjust( &dmass, mass );
>    dmass.mass = mass;
>    dBodySetMass( bodies[name], &dmass );
>    return true;
> }
> What value do you feed into this function for mass?
> Are you sure it is non-zero, and not NaN ?
>   Bram
> --
> Zapp: Captain's log, stardate...er..
> Kif: Ohhh. April 13th.
> Zapp: April 13th. Point 2.

Connect and share in new ways with Windows Live.

More information about the ODE mailing list