[ODE] weird slider behaviour (solved)

Jaroslav Sinecky jsinecky at tiscali.cz
Tue Sep 13 17:46:34 MST 2005


Did this really solve your problem? Strange that noone had the same problem
with sliders before (though not impossible).
I had a look at your patch and original code and dont really see why there
should be factor of 0.25. I don't have it very clear how exactly the
jointInfo2 is used during simulation, so just with intuition ...

if the slider limot force f is applied to each body in direction of slider
axis and at cog of each body, the resulting torque is f*d (d = distance of
bodies cogs perpendicular to the axis). So the correction torque should be
0.5*f*d for each body.

Someone other had a look or tried this patch?

Jaroslav


> -----Original Message-----
> From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf
> Of Georg Martius
> Sent: Sunday, September 11, 2005 9:07 PM
> To: ode at q12.org
> Subject: Re: [ODE] weird slider behaviour (solved)
>
>
> Hallo again,
>
> since I got no answer to my question I took a look into the ode
> souce code and
> found the problem :-)
>
> The thing is that for slider joints there is a  "Linear Torque Decoupling
> vector (a torque)" for the case that the slider axis and the
> positions of the
> bodies do not match exacly. AFAIK this can happen in two cases. 1. if the
> slider axis is not set properly at start or 2. if the slider rotates.
>
> Well there was just a wrong factor used, so that the double
> correction was
> applied. Additionally I added the same threatment fo
> dJointAddSliderForce.
> Now the 	angular momentum is conserved for the rotating
> system with sliders.
>
> Please find the patch attached. It would be very nice if someone
> who is really
> into the stuff could comment on this and maybe include it into the CVS
> version.
>
> Cheers,
>  Georg
>
>
> Am Montag, 29. August 2005 22:06 schrieb Georg Martius:
> > Hello,
> >
> > I experience a weird behaviour with slider joints. I have two
> objects which
> > are connected with a slider joint. If I give the system an
> initial torque
> > it will accelerate until it breaks. I also played a bit with bounce, cfm
> > and erm of the joint but without success.
> >
> > Any help would be appreciated.
> >
> > Cheers,
> >  Georg
> >
> > compiled with
> >
> > > gcc -Wall   sliderrotation.c -o slidertest -lode -ldrawstuff
> -lGL -lGLU
> >
> > <sliderrotation.c>
> > #include <ode/ode.h>
> > #include <ode/common.h>
> > #include <drawstuff/drawstuff.h>
> >
> > dWorldID world;
> > dSpaceID space;
> > dBodyID body1;
> > dBodyID body2;
> >
> > void start(){
> >   dMass mass1,mass2;
> >   body1 = dBodyCreate ( world );
> >   dBodySetPosition ( body1 , 0, 0, 2 );
> >   dMassSetSphereTotal (  &mass1 , 1 , 1 );
> >   dBodySetMass ( body1 , &mass1 );
> >   body2 = dBodyCreate ( world );
> >   dBodySetPosition ( body2 , 2, 0, 2 );
> >   dMassSetSphereTotal (  &mass2 , 1 , 1 );
> >   dBodySetMass ( body2 , &mass2 );
> >
> >   dJointID slider = dJointCreateSlider ( world , 0 );
> >   dJointAttach ( slider , body1 , body2 );
> >   dJointSetSliderAxis  ( slider, 1, 0, 0 );
> >   dJointSetSliderParam ( slider, dParamLoStop, -0.1 );
> >   dJointSetSliderParam ( slider, dParamHiStop, 0.1 );
> >
> >   dBodyAddTorque(body1,0,0,100);
> >   dBodyAddTorque(body2,0,0,100);
> > }
> >
> > void simLoop(int pause){
> >   int i;
> >   for(i=0; i < 10; i++){
> >     dWorldStep ( world , 0.01 );
> >   }
> >   dsSetColor ( 1, 0, 0 );
> >   dsDrawSphereD ( dBodyGetPosition (body1) , dBodyGetRotation
> (body1) ,1 );
> >   dsSetColor ( 0, 1, 0 );
> >   dsDrawSphereD ( dBodyGetPosition (body2) , dBodyGetRotation
> (body2) ,1 );
> >
> > }
> >
> > int main(int argc, char** argv){
> >
> >   dsFunctions fn;
> >   fn.version = DS_VERSION;
> >   fn.start = &start;
> >   fn.step = &simLoop;
> >   fn.command = 0;
> >   fn.stop = 0;
> >   fn.path_to_textures = "../textures";
> >
> >   world = dWorldCreate ();
> >   space = dHashSpaceCreate (0);
> >   dWorldSetGravity ( world , 0 , 0 , 0 );
> >   dWorldSetERP ( world , 1 );
> >
> >   dsSimulationLoop ( argc , argv , 640 , 480 , &fn );
> >
> >   return 0;
> > }
> > </sliderrotation.c>
>
> --
> ---- Georg Martius,  Tel: (+49 34297) 89434 ----
> ------- http://www.flexman.homeip.net ---------
>



More information about the ODE mailing list