[ODE] dJointGetHinge2Angle2

Remi Ricard remi.ricard at simlog.com
Thu May 3 07:46:30 MST 2007


 > In the hinge2 code we can see:
 > 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);
 > }
 > This code is called to know the vertical axis angle. Does someone 
know how to get the angle of the horizontal axis ?
 > I saw in the archive mails that it is a recurent question ... then if 
someone know how to do it will help a lot of ode users :)

I took a look in the code and there is no information of the relative 
orientation of Body1 and Body2 along the horizontal axis.

Other joint have a Quaternion (qrel) to keep the initial difference in 
orientation but the Hinge2 uses 2 vectors to help retrieve the vertical 

If you replace those 2 vectors by a qrel you should be able to find both 

You can look at the Universal joint to implement the code.


More information about the ODE mailing list