[ODE] Sphere to plane friction seems nonexistent

John Kotas johnkotas at hotmail.com
Sat Feb 9 11:49:02 2002


This is a multi-part message in MIME format.

------=_NextPart_000_0005_01C1B171.389B30C0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Does anyone know why a sphere keeps rolling on a completely flat plane =
and doesn't slowly come to a stop.  I would think that the friction =
contact point of the plane to the sphere would cause the sphere to =
slowly stop.  If you could give me an example of a nearCallback function =
that causes friction between my flat plane and the sphere I would be =
grateful.  The following is MY nearCallback function (the one that lets =
the sphere roll on to infinity) and is called from my simloop:

static void nearCallback (void *data, dGeomID o1, dGeomID o2)
{
  int i;

  // only collide things with the ground
  int g1 =3D (o1 =3D=3D ground);
  int g2 =3D (o2 =3D=3D ground);
  if (!(g1 ^ g2)) return;

  dBodyID b1 =3D dGeomGetBody(o1);
  dBodyID b2 =3D dGeomGetBody(o2);

  dContact contact[3];  // up to 3 contacts per sphere
  for (i=3D0; i<3; i++) {
    contact[i].surface.mode =3D dContactSoftCFM | dContactApprox1;
    contact[i].surface.mu =3D 0.5;
    contact[i].surface.soft_cfm =3D 0.01;
  }
  if (int numc =3D dCollide (o1,o2,3,&contact[0].geom,sizeof(dContact))) =
{
    for (i=3D0; i<numc; i++) {
      dJointID c =3D dJointCreateContact (world,contactgroup,contact+i);
      dJointAttach (c,b1,b2);
    }
  }
}

I have noticed that adding mass to the spheres merely requires more =
force to be added to start the spheres rolling, but it doesn't cause =
them to slow down once they are rolling.  Again, a nearCallback function =
that would keep my spheres from rolling on indefinitely would be greatly =
appreciated.

Thank you,

John Kotas


------=_NextPart_000_0005_01C1B171.389B30C0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Does anyone know why a sphere keeps =
rolling on a=20
completely flat plane and doesn't slowly come to a stop.&nbsp; I would =
think=20
that the friction contact point of the plane to the sphere would cause =
the=20
sphere to slowly stop.&nbsp; <FONT face=3DArial size=3D2>If you could =
give me an=20
example of a nearCallback function that causes friction between my flat =
plane=20
and the sp</FONT>here I would be grateful.&nbsp; The following is MY=20
nearCallback function (the one that lets the sphere roll on to infinity) =
and is=20
called from my simloop:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>static void nearCallback (void *data, =
dGeomID o1,=20
dGeomID o2)<BR>{<BR>&nbsp; int i;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; // only collide things with the=20
ground<BR>&nbsp; int g1 =3D (o1 =3D=3D ground);<BR>&nbsp; int g2 =3D (o2 =
=3D=3D=20
ground);<BR>&nbsp; if (!(g1 ^ g2)) return;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; dBodyID b1 =3D =
dGeomGetBody(o1);<BR>&nbsp;=20
dBodyID b2 =3D dGeomGetBody(o2);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; dContact =
contact[3];&nbsp;&nbsp;// up to 3=20
contacts per sphere<BR>&nbsp; for (i=3D0; i&lt;3; i++) =
{<BR>&nbsp;&nbsp;&nbsp;=20
contact[i].surface.mode =3D dContactSoftCFM |=20
dContactApprox1;<BR>&nbsp;&nbsp;&nbsp; contact[i].surface.mu =3D=20
0.5;<BR>&nbsp;&nbsp;&nbsp; contact[i].surface.soft_cfm =3D =
0.01;<BR>&nbsp;=20
}<BR>&nbsp; if (int numc =3D dCollide=20
(o1,o2,3,&amp;contact[0].geom,sizeof(dContact))) {<BR>&nbsp;&nbsp;&nbsp; =
for=20
(i=3D0; i&lt;numc; i++) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dJointID c =
=3D=20
dJointCreateContact=20
(world,contactgroup,contact+i);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
dJointAttach=20
(c,b1,b2);<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; }<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have noticed that adding mass to the =
spheres=20
merely requires more force to be added to start the spheres rolling, but =
it=20
doesn't cause them to slow down once they are rolling.&nbsp; Again, a=20
nearCallback function that would keep my spheres from rolling on =
indefinitely=20
would be greatly appreciated.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thank you,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>John Kotas</FONT></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0005_01C1B171.389B30C0--