[ODE] Patch to optimize the angles calculation of Universal joint
Jean de Largentaye
jlargentaye at gmail.com
Fri Apr 28 04:42:14 MST 2006
Well, I can't do this right now, but if you have the courage to
recompile ODE from source, dJointGetHinge2Angle1 is defined in
joint.cpp line 1775:
dReal dJointGetHinge2Angle1 (dJointID j)
{
dxJointHinge2* joint = (dxJointHinge2*)j;
dUASSERT(joint,"bad joint argument");
dUASSERT(joint->vtable == &__dhinge2_vtable,"joint is not a hinge2");
if (joint->node[0].body) return measureHinge2Angle (joint);
else return 0;
}
You see it's main job is calling measureHinge2Angle(), which is
defined line 1485 as:
static dReal measureHinge2Angle (dxJointHinge2 *joint)
{
dVector3 a1,a2;
dMULTIPLY0_331 (a1,joint->node[1].body->posr.R,joint->axis2);
dMULTIPLY1_331 (a2,joint->node[0].body->posr.R,a1);
dReal x = dDOT(joint->v1,a2);
dReal y = dDOT(joint->v2,a2);
return -dAtan2 (y,x);
}
So what you could do is add your own dJointGetHinge2Angle2 that, after
the appropriate tests, would call your own measureHinge2Angle2. This
is where your math happens, and it shouldn't be too complicated to
copy-modify measureHinge2Angle for it to return Angle2 (though I
haven't thought about it much more).
I hope this can help you implement your own GetHinge2Angle2. IM(v)HO,
once (if) you do this patch, I don't think it would be useful to give
it to us, because you're using Hinge2 in a situation where you should
rather be using 2 standard Hinges. IE, I still disagree on your use of
Hinge2 in this situation. But I've been known for blathering nonsense
;)
Regards,
Jean
On 4/28/06, LR <logreg at free.fr> wrote:
> Re, and thank you for your responses :)
>
> 1] The sliping problem is not a problem : on a real robot there is the same
> problem. I want to simulate a robot as its reality.
> 2] i want to simulate a commercial robot with a speed < 40cm / seconds.
> Then, the wheel cannot made have 360 ° for a second.
>
>
> I want to simulate the odometry like it's donne on a real robot (sliping is
> not a problem : it's just like reality). For the first robot a made, i used
> a hinge joint and computed odometry using the HingeGetAngle1 function. Now,
> using a hinge 2 joint, i would like to do the same ...
>
> Laurent
>
>
>
> -----Message d'origine-----
> De : Jean de Largentaye [mailto:jlargentaye at gmail.com]
> Envoyé : vendredi 28 avril 2006 12:24
> À : LR
> Cc : ODE Mailing List (E-mail)
> Objet : Re: [ODE] Patch to optimize the angles calculation of Universal
> joint
>
> By odometry, you mean the distance traveled by your object, right? I'm not
> sure of any good solution, but I have doubts that Angle2 would be useful, if
> only because your wheel could have turned more than 360 degrees between each
> step. So the returned value will already be modulo 360 degrees since the
> last step. Wouldn't this be a problem for you?
>
> Furthermore, are you sure your vehicle hasn't "slipped" on the terrain? In
> which case, even if you do have adequate values of Angle2, it won't be
> consistent with the distance traveled by the vehicle.
>
> I guess just making a sum of distances traveled by the centre of mass of
> your vehicle between each time step isn't what you're looking for?
>
> Regards,
> Jean
>
> On 4/28/06, LR <logreg at free.fr> wrote:
> > Hi,
> >
> > In fact i use a hinge 2 to have a suspention on axis 1 and wheel on
> > axis2 (of course !).
> > On each axis a have to know angle to compute odometry (odometrics ?
> > Odometers ?).
> > Today, for the axis 2, i use AngleRate to compute wheel odometry but
> > the rate is not efficient, i must look at what happend every time step.
> >
> > On the hinge joint, it's easy using GetAngle to compute the odometry,
> > on
> > hinge2 it's not ...
> >
> > In my precedents mails i confused axis 1 and axis2, sorry. But my real
> > problem is to know the two angles to compute a good odometry for each
> axis.
> > Then i think GetAxis2Angle (or GetHinge2Angles) should be a good feature.
> >
> >
> > Laurent.
> >
> >
> > -----Message d'origine-----
> > De : Jean de Largentaye [mailto:jlargentaye at gmail.com] Envoyé :
> > vendredi 28 avril 2006 09:30 À : LR Cc : ODE Mailing List (E-mail)
> > Objet : Re: [ODE] Patch to optimize the angles calculation of
> > Universal joint
> >
> > Hi Laurent,
> >
> > I remain surprised that you'd need the Hinge2 Angle2 value, especially
> > for changing the direction of the wheel. For that you should only need
> > Angle1
> >
> > The point of hinge2 is that the object on Axis2 turns quickly,
> > typically a wheel. The angle of that object isn't really important,
> > only its speed is (Angle2Rate). Or maybe in your situation it's
> > turning slowly, but in that case you shouldn't be using Hinge2, but rather
> two hinges, I believe.
> >
> > My understanding is that GetHinge2Angle2 was omitted purposefully, so
> > that people wouldn't want to use Hinge2 in a situation where they
> > would need Angle2.
> >
> > But then, maybe I'm ignoring some blatant fact or specific case. Damn
> > fridays :)
> >
> > Jean
> >
> > On 4/27/06, LR <logreg at free.fr> wrote:
> > > Hi,
> > >
> > > Do you think you can code the dJointGetHinge2Angle2 function ? Or
> > > Codeing the getHing2Angles ?
> > >
> > > Laurent.
> > >
> > >
> > > -----Message d'origine-----
> > > De : ode-bounces at q12.org [mailto:ode-bounces at q12.org] De la part de
> > > Remi Ricard Envoyé : jeudi 27 avril 2006 19:44 À : ODE Mailing List
> > > (E-mail) Objet : [ODE] Patch to optimize the angles calculation of
> > > Universal joint
> > >
> > > Hi,
> > >
> > > This is patch optimize the way to get both angles for the Universal
> joint.
> > >
> > > Instead of calling getUniversalAngle1 and getUniversalAngle2 and
> > > doing some redundant stuff I added the function
> > > getUniversalAngles(j, angle1,
> > angle2).
> > >
> > > I did some testing and the function universalGetInfo1 using the
> > > getUniversalAngles to find both angles is 23% faster.
> > >
> > > The patch is done againts latest svn trunk (2006/04/27).
> > >
> > > I submitted the patch on the sourceforge website.
> > >
> > > I'm only posting this here to let the developer with svn acces know
> > > that there is a new patch.
> > >
> > > The patch is produced with:
> > > svn diff >> ../add_getUniversalAngles.patch
> > >
> > > Description:
> > > Add a function optimizing the calculation of both angles of the
> > > universal joint.
> > >
> > >
> > > Remi
> > > _______________________________________________
> > > ODE mailing list
> > > ODE at q12.org
> > > http://q12.org/mailman/listinfo/ode
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > ODE mailing list
> > > ODE at q12.org
> > > http://q12.org/mailman/listinfo/ode
> > >
> >
> >
> >
> >
>
>
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
More information about the ODE
mailing list