[ODE] Friction problems & Donating Sample Code to ODE
Rob Leclerc
leclerc at cpsc.ucalgary.ca
Sun Apr 13 14:39:01 2003
Friction Problems
==================
I am working on some code to evolve a neural network to control the
movements of a simple dog like body. Unfortunately, it looks like I
might be having some difficulties with friction, as the best evolved
creature looks like he is trying to move on an ice rink!
I am using the piece of code below for the CD, which I grabbed from one
of the examples. I had thought that setting surface.mu = dInfinity would
have worked, but it doesn't seem to be doing what I want it to. To be
honest, I don't know all the physics that well and I was hoping that
maybe someone might know how I can get over this problem. (Code Below)
Donating Sample Code to ODE project
===================================
Ironically, I had problems putting this model together in CM Labs,
Vortex; there were some major instabilities that I couldn't get worked
out and tech support has been looking at it for a week now without much
luck apparently. Kudos to ODE, since I think I am pretty close to
getting this working in only a couple of days, and thanks for everyone
for their help so far. Anyway, this is a project for a grad course I am
doing and I am basically generating a life-like skeleton to put an
"implicit surface" in order to get a nice life-like body. Anyway, I was
wondering if there was someone I could donate this code to, for the ODE
project once everything is worked out (I am almost done). Basically, the
code creates a dog like creature and evolves the weights of a neural
network to get it to move. I thought it might be useful for anyone
interested in doing virtual creature modeling.
/** Code I am using for CD **/
static void nearCallback (void *data, dGeomID o1, dGeomID o2)
{
int i;
// exit without doing anything if the two bodies are connected by a
joint
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;
contact[i].surface.mu = dInfinity;
contact[i].surface.mu2 = dInfinity;
contact[i].surface.bounce = 0.1;
contact[i].surface.bounce_vel = 0.1;
contact[i].surface.soft_cfm = 0.01;
}
if (int numc = dCollide (o1,o2,4,&contact[0].geom,sizeof(dContact)))
{
dMatrix3 RI;
dRSetIdentity (RI);
const dReal ss[3] = {0.02,0.02,0.02};
for (i=0; i<numc; i++) {
dJointID c = dJointCreateContact
(world,contactgroup,contact+i);
dJointAttach (c,b1,b2);
}
}
}
==============================
Rob Leclerc
University of Calgary
Department of Computer Science
Office: ICT 728
==============================