[ODE] Slider Patch [Fwd: RE: weird slider behaviour (solved)]

Georg Martius mai99dgf at studserv.uni-leipzig.de
Tue Nov 29 02:35:08 MST 2005


Hello,

as there is a patch collection process ongoing, I would like to remind 
to the following patch. I didn't find it in on the bugtracker, but I 
might have overlooked something.
For some reason the forwarded email and some other emails of this thread 
are not in the mail archives!

Cheers,
   Georg

-------- Original Message --------
Subject: RE: [ODE] weird slider  behaviour (solved)
Date: Wed, 14 Sep 2005 10:48:04 +0200
From: Jaroslav Sinecky <jsinecky at tiscali.cz>
To: Georg Martius <mai99dgf at studserv.uni-leipzig.de>, <ode at q12.org>

Hi Georg,
really your test case is very clear, I looked again at the code and I think
I got it. There is a simple typo in the sliderGetInfo2 function which causes
the rotational part of last two lines of Jacobian for first body not to be
filled!!
By (not so extraordinary) coincidence in your case this error was exactly
compensated by putting factor 0.25 instead of 0.5 for decoupling torque.

With this typo corrected your test case works fine now, also with
dJointAddSliderForce. I also tried to shift the ball along Y axis in
opposite directions, so that decoupling torque has more effect (if both
balls lies on X axis, this torque is zero apart of slider disalignment).
I also remembered of one of my old case where I tried to use sliders and it
didn't work (I was blaming whatever but the slider), I tried it now and it
works well.

I send modified Georg's patch (against cvs head 1.58). I think the
adjustment in dJointAddSliderForce is a good idea, but the docs should also
be changed a bit because now it says "This function is just a wrapper for
dBodyAddForce()."

Cheers!
Jaroslav



> -----Original Message-----
> From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf
> Of Georg Martius
> Sent: Tuesday, September 13, 2005 9:56 PM
> To: ode at q12.org
> Subject: Re: [ODE] weird slider behaviour (solved)
>
>
> Am Dienstag, 13. September 2005 17:46 schrieb Jaroslav Sinecky:
> > Did this really solve your problem?
> Yes,  it did.
>
> > Strange that noone had the same problem
> > with sliders before (though not impossible).
> Might be possible because it just occurs if the system rotating.
>
> > 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.
> Well I don't know how jointInfo2 really works. And I would have
> thought 0.5 is
> the right factor as well. Anyway if you try the code I attached
> you will see
> what happens.
> With the original ode you will find the system to accelerate, but
> it should
> stay at the same speed.
> If you uncomment the line with addSliderForce you see that the
> system slows
> down.
>
> Thanks for you comment.
>
> Georg
> >
> > 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 ---------
>
> --
> ---- Georg Martius,  Tel: (+49 34297) 89434 ----
> ------- http://www.flexman.homeip.net ---------
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ode-0.5_slider_torques_ver2.patch
Type: application/octet-stream
Size: 1753 bytes
Desc: not available
Url : http://q12.org/pipermail/ode/attachments/20051129/f50a786c/ode-0.5_slider_torques_ver2.obj


More information about the ODE mailing list