[ODE] Fixed joints create bizzare behavior

Tim Rightnour root at garbled.net
Wed Nov 10 21:44:14 MST 2004

I think something is not quite right with fixed joints.

I've performed two different tests, both using the basic framework for
test_boxstack.cpp.  The first test was in trying to find a way to make AMotors
work for me.  In this test, I created a body with no geometry, created a fixed
joint, and bound that body to the world.  I then created two cylinders, and
attached them to the fixed body via amotors.  When an object would hit the
first body, it would then cause both bodies to fall over in the exact same
direction.  This doesn't make any sense to me at all.

Second test, was to just take one of my cylinders, and fix joint it to the
world.  Two things happened here that I found very very bizzare:

1) The objects usually start a bit above the ground, and fall to it.  With the
fixed joint, I expected the body to remain in the air.  It did not, and rather,
it fell to the ground.

2) When a box was dropped on the object, rather than colliding with the box,
the box falls clear through the object, and then jitters madly.  You end up
with a cylinder, sticking straight up, through a box on the ground, both

I'm pasting the code I added to main() of test_boxstack.cpp.  I'm using CVS ode
library as of 3 days ago, but the test_boxstack.cpp I based this on was from
0.5. The if 1 changes from the first case I described, to the second.

As an aside, I have also noticed something odd when using high gravity and high
mass.  With a gravity of Z-30, and a mass of 10.0 on my cylinder, the cylinder
falls until it is exactly below the plane.  Why does this occur?

  dWorldSetGravity (world,0,0,-30);
  dWorldSetCFM (world,1e-1);
  dWorldSetAutoDisableFlag (world,1);
  //dWorldSetContactMaxCorrectingVel (world,0.1);
  //dWorldSetContactSurfaceLayer (world,0.001);
  dCreatePlane (space,0,0,1,0);
  memset (obj,0,sizeof(obj));

  i = nextobj;
  nextobj++; num++;
  obj[i].geom[0] = dCreateCCylinder(space, 0.1, 0.3);
  obj[i].body = dBodyCreate(world);
  st = dBodyCreate(world); 
  jk = dJointCreateFixed(world, 0);
  dJointAttach(jk, st, 0);
  dBodySetPosition(st, 0, 0, 0);
  dGeomSetBody(obj[i].geom[0], obj[i].body);
  dBodySetPosition(obj[i].body, 0, 0, 1);
  dMassSetCappedCylinderTotal(&m, 1.0, 3, 0.1, 0.3);
  dBodySetMass (obj[i].body, &m);

#if 1
  jj = dJointCreateFixed(world, 0); 
  dJointAttach(jj, obj[i].body, 0); 
  jj = dJointCreateAMotor(world, 0);
  dJointAttach(jj, obj[i].body, 0);
  dJointSetAMotorNumAxes(jj, 2);
  dJointSetAMotorAxis(jj, 0, 1, 1, 0, 0); // X
  dJointSetAMotorAxis(jj, 1, 1, 0, 1, 0); // Y
  dJointSetAMotorParam(jj, dParamVel, 0.0);
  dJointSetAMotorParam(jj, dParamVel2, 0.0);
  dJointSetAMotorParam(jj, dParamFMax, 100.0);
  dJointSetAMotorParam(jj, dParamFMax2, 100.0);

  i = nextobj;
  nextobj++; num++;
  obj[i].geom[0] = dCreateCCylinder(space, 0.1, 0.3);
  obj[i].body = dBodyCreate(world);
  dGeomSetBody(obj[i].geom[0], obj[i].body);
  dBodySetPosition(obj[i].body, 1, 0, 1);
  jl = dJointCreateAMotor(world, 0);
  dJointAttach(jl, obj[i].body, st);
  dJointSetAMotorNumAxes(jl, 2);
  dJointSetAMotorAxis(jl, 0, 1, 1, 0, 0); // X
  dJointSetAMotorAxis(jl, 1, 1, 0, 1, 0); // Y
  dJointSetAMotorParam(jl, dParamVel, 0.0);
  dJointSetAMotorParam(jl, dParamVel2, 0.0);
  dJointSetAMotorParam(jl, dParamFMax, 100.0);
  dJointSetAMotorParam(jl, dParamFMax2, 100.0);

Tim Rightnour <root at garbled.net>
NetBSD: Free multi-architecture OS http://www.netbsd.org/
NetBSD supported hardware database: http://mail-index.netbsd.org/cgi-bin/hw.cgi

More information about the ODE mailing list