[ODE] Joints again

Nate W coding at natew.com
Thu Dec 19 12:46:02 2002


On Thu, 19 Dec 2002, Marco Vienup wrote:

> I want connect two boddys with a hinge joint. Give the joint a
> specific angle and the result should be the torque in the joint.
> (Does someone know how I can solve the problem in ode ?)

Look into the joint motor functions.  They actually expect a 'desired
velocity' rather than 'desired angle' but you can compute the velocity
with a simple function like this:
	DesiredVelocity = Gain * (ActualAngle - DesiredAngle)
The Gain parameter may require some trial and error, but 0.1 has worked
for me in most cases. 

> First I attached two boddy´s with a ball joint.
> I wonder that there is no function to get the angels of the joint ?

Just compare the orientation of each body connected by the ball joint.  
Hinge joints only allow rotation along one axis, so it makes sense to have
a function that gets that angle... but ball joints allow rotation in all
three axes, so there is not much that ODE can do to help you get the
angles you're interested in.

> My second try was the hinge. I setup the Anchor and tryed to setup
> the Axis. But when I use dJointGetHingeAxis(...) it returns differnt values.
> The manual says "When an axis is set it will be normalized to unit length.
> The adjusted axis is what the axis getting functions will return."
> But I am not sure what it mean.

It means that the axis vector you get back will still point in the same
direction as the axis vector you supplied, but it may be a different
length.  

You should also keep in mind that if you connect two bodies with a hinge,
they may still be free to tumble in space.  They will tumble together
because of the hinge, but that can change the hinge axis.

-- 

Nate Waddoups
Redmond WA USA
http://www.natew.com