[ODE] noob problems (four wheeled car)

mark mcgree markmcgree226 at hotmail.com
Wed Jun 14 14:25:43 MST 2006


hi
i have sent this e-mail before but it was before i received my comfermation 
e-mail so i do not know if it went through if it did sorry for double 
posting

i am new to ode and i am having problems modelling a 4 wheel car and am 
presently having 2 problems.

the first problems is with the wheels while they are turning while a wheel 
is turned it continued to rotate on the y axis that it would rotate on if it 
was straight as opposed to its new y axis. here is some code that shows how 
i am setting up the wheels and the hinges(the code has been mostly taken 
from the test buggy example)
for (int i=0; i<4; i++) {
    _wheelBody[i] = dBodyCreate (world);
     dMassSetSphere (&m,1,1.0);
     dMassAdjust (&m,20);
    dBodySetMass (_wheelBody[i],&m);
    sphere[i] = dCreateSphere (0,1.0);
    dGeomSetBody (sphere[i],_wheelBody[i]);
    D3DXMATRIX zRot;
    D3DXMatrixRotationZ(&zRot, 3.14f);
    dMatrix3 dRot={
       1,0,0,0,
       0,1,0,0,
       0,0,1,0};
    dRSetIdentity (dRot);
     dRFromAxisAndAngle (dRot,
                         0, 0, 1, 3.14);
      dBodySetRotation( _wheelBody[i], dRot );
  }

i am rotating the bodies because directx always draws cylinders with its 
height along the y axis and if i rotate the bodies 180 around the z axis i 
this way i only need to use the rotation matrixs from ode.

for (int i=0; i<4; i++) {
    _joint[i] = dJointCreateHinge2 (world,0);
    dJointAttach (_joint[i],_chassisBody,_wheelBody[i]);
    const dReal *a = dBodyGetPosition (_wheelBody[i]);
    dJointSetHinge2Anchor (_joint[i],a[0],a[1],a[2]);
    dJointSetHinge2Axis1 (_joint[i],0,1,0);
    dJointSetHinge2Axis2 (_joint[i],0,0,1);
  }

  for (int i=0; i<4; i++) {
    dJointSetHinge2Param (_joint[i],dParamSuspensionERP,0.4);
    dJointSetHinge2Param (_joint[i],dParamSuspensionCFM,0.8);
  }

  // lock back wheels along the steering axis
  for (int i=2; i<4; i++) {
    // set stops to make sure wheels always stay in alignment
    dJointSetHinge2Param (_joint[i],dParamLoStop,0);
    dJointSetHinge2Param (_joint[i],dParamHiStop,0);
  }

the second problem involves the chasis while in a turn the chassis rotates 
out of sink with the wheels. i think that this problems involves collision 
reactions between the chasis and wheel geoms. is there a could way to make 
sure that contacts between geoms within the car space are ignored?

_________________________________________________________________
Customise your home page with RSS feeds at MSN Ireland! http://ie.msn.com/



More information about the ODE mailing list