[ODE] joint or not joint

Michael Scharvogel thubba at gmx.net
Thu Aug 8 08:42:01 2002


This is a multi-part message in MIME format.

------=_NextPart_000_0028_01C23F02.984DB870
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi folks...

I got stuck again concerning a hinge joint this time.
I altered the test_boxstack example, disabling the command function (I =
just don't react to keys now) and jsut adding two boxes falling down =
from 1 unit height.=20
I think, they have mass and everything.=20
But on adding a hinge joint the systems behaviour is hard to get for me. =
One body adduct the other one an they bounce off after colliding. I have =
set the simulation speed quiet low and the adduction happens with =
relative immense speed. (more than the bodies falling down)..

Here's the creation code:
 dReal sides[3] =3D { .5, .5, .5};
 dReal pos1[3] =3D { 0, 0, 1};
 dReal pos2[3] =3D { 0, 1, 1};

 dMatrix3 matrix;
 dMass mass1;
 dMass mass2;
=20
 // Creating a default mass and rotation
 dMassSetBox (&mass1, 17, sides[0], sides[1], sides[2]);
 dMassSetBox (&mass2, 5, sides[0], sides[1], sides[2]);
 dRFromAxisAndAngle(matrix, 0, 0, 1, 0);

=20
 // first Object
 obj[0].body =3D dBodyCreate(world);
 obj[0].geom[0] =3D dCreateBox(space, sides[0], sides[1], sides[2]);
 dGeomSetBody(obj[0].geom[0], obj[0].body);
 dBodySetMass(obj[0].body, &mass1);
 num++;

 // second Object
 obj[1].body =3D dBodyCreate(world);
 obj[1].geom[0] =3D dCreateBox(space, sides[0], sides[1], sides[2]);
 dGeomSetBody(obj[1].geom[0], obj[1].body);
 dBodySetMass(obj[1].body, &mass2);=20
 num++;

 // now setting the positions
 dBodySetPosition(obj[0].body, pos1[0], pos1[1], pos1[2]);
 dBodySetPosition(obj[1].body, pos2[0], pos2[1], pos2[2]);

// Now a joint
 //dJointGroupID jointGroup =3D dJointGroupCreate(2);
 contactgroup =3D dJointGroupCreate(0);
 joint =3D dJointCreateHinge(world, contactgroup);
 dJointSetHingeAxis(joint, 1, 0, 0);
 dJointSetHingeAnchor(joint, 0, 0.5, 1);


 dJointAttach(joint, obj[1].body, obj[0].body);

The strange setting of bodies and geoms comes from the examples =
structure.
Maybe someone can tell me where I am mistaken. Do bodies that I connect =
by a hinge have to intersect ? Or is it just some strange coding bug =
again ?

The effect also appears if I don't set the Hinges Axis and anchor...

Maybe you can help me again...

(and sorry for asking so many questions...)

thanx again, mike.


------=_NextPart_000_0028_01C23F02.984DB870
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 http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi folks...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I got stuck again concerning a hinge =
joint this=20
time.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I altered the test_boxstack example, =
disabling the=20
command function (I just don't react to keys now) and jsut adding two =
boxes=20
falling down from 1 unit height. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I think, they have mass and everything. =

</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>But on adding a hinge joint the systems =
behaviour=20
is hard to get for me. One body&nbsp;adduct the other one an they bounce =
off=20
after colliding. I have set the simulation speed quiet low and the =
adduction=20
happens with relative immense speed. (more than the bodies falling=20
down)..</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Here's the creation code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;dReal sides[3] =3D { .5, .5,=20
.5};<BR>&nbsp;dReal pos1[3] =3D { 0, 0, 1};<BR>&nbsp;dReal pos2[3] =3D { =
0, 1,=20
1};</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;dMatrix3 matrix;<BR>&nbsp;dMass=20
mass1;<BR>&nbsp;dMass mass2;<BR>&nbsp;<BR>&nbsp;// Creating a default =
mass and=20
rotation<BR>&nbsp;dMassSetBox (&amp;mass1, 17, sides[0], sides[1],=20
sides[2]);<BR>&nbsp;dMassSetBox (&amp;mass2, 5, sides[0], sides[1],=20
sides[2]);<BR>&nbsp;dRFromAxisAndAngle(matrix, 0, 0, 1, 0);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;<BR>&nbsp;// first=20
Object<BR>&nbsp;obj[0].body =3D =
dBodyCreate(world);<BR>&nbsp;obj[0].geom[0] =3D=20
dCreateBox(space, sides[0], sides[1],=20
sides[2]);<BR>&nbsp;dGeomSetBody(obj[0].geom[0],=20
obj[0].body);<BR>&nbsp;dBodySetMass(obj[0].body,=20
&amp;mass1);<BR>&nbsp;num++;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;// second =
Object<BR>&nbsp;obj[1].body =3D=20
dBodyCreate(world);<BR>&nbsp;obj[1].geom[0] =3D dCreateBox(space, =
sides[0],=20
sides[1], sides[2]);<BR>&nbsp;dGeomSetBody(obj[1].geom[0],=20
obj[1].body);<BR>&nbsp;dBodySetMass(obj[1].body,=20
&amp;mass2);&nbsp;<BR>&nbsp;num++;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;// now setting the=20
positions<BR>&nbsp;dBodySetPosition(obj[0].body, pos1[0], pos1[1],=20
pos1[2]);<BR>&nbsp;dBodySetPosition(obj[1].body, pos2[0], pos2[1],=20
pos2[2]);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>// Now a joint<BR>&nbsp;//dJointGroupID =
jointGroup=20
=3D dJointGroupCreate(2);<BR>&nbsp;contactgroup =3D=20
dJointGroupCreate(0);<BR>&nbsp;joint =3D dJointCreateHinge(world,=20
contactgroup);<BR>&nbsp;dJointSetHingeAxis(joint, 1, 0,=20
0);<BR>&nbsp;dJointSetHingeAnchor(joint, 0, 0.5, 1);</FONT></DIV>
<DIV>&nbsp;</DIV><FONT face=3DArial size=3D2>
<DIV><BR>&nbsp;dJointAttach(joint, obj[1].body, obj[0].body);</DIV>
<DIV>&nbsp;</DIV>
<DIV>The strange setting of&nbsp;bodies and geoms&nbsp;comes from the =
examples=20
structure.</DIV>
<DIV>Maybe someone can tell me where I am mistaken. Do bodies that I =
connect by=20
a hinge have to intersect ? Or is it just some strange coding bug again =
?</DIV>
<DIV>&nbsp;</DIV>
<DIV>The effect also appears if I don't set the Hinges Axis and =
anchor...</DIV>
<DIV>&nbsp;</DIV>
<DIV>Maybe you can help me again...</DIV>
<DIV>&nbsp;</DIV>
<DIV>(and sorry for asking so many questions...)</DIV>
<DIV>&nbsp;</DIV>
<DIV>thanx again, mike.</DIV>
<DIV></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0028_01C23F02.984DB870--