# [ODE] Hinge angle convention

Ross L. Hatton rlhatton at cmu.edu
Mon Jun 25 15:20:07 MST 2007

```I found this as lines 344-345 in joint.cpp:

>>  // the angle we've just extracted has the wrong sign
>>  theta = -theta;

without any any other explanation.  This would appear to be related to
the problem, but I'd appreciate hearing from whoever wrote the function
before forging ahead.  If that person's not here, is there someone with
better svn skills than me interested in tracking down its origins?

-Ross

Gazi Alankus wrote:
> I'm going to agree on this, I negate the angle before giving it to ODE
> and after getting it from ODE so that my right handed math outside ODE
> works. I wanted to find out the reason before posting this but I
> didn't want to spend too much time on what exactly dQMultiply1 and
> dQMultiply2 do. There might be a wrong assumption when finding the
> relative quaternion / getting the angle from the relative quaternion.
>
> AFAIK, the positive direction of the angle should be on the direction
> of the right hand's fingers from the first body to the second body
> when the right thumb points towards the joint axis.
>
> -Gazi
>
>
> On 25/06/07, yyd_iris at yahoo.com <yyd_iris at yahoo.com> wrote:
>> I have the same problem. The joints are left-handed. I
>> temporarily set axis to be [0, 0, -1].
>>
>> --- "Ross L. Hatton" <rlhatton at cmu.edu> wrote:
>>
>>> Hi all,
>>>
>>> Is there documentation on the handedness of the
>>> angle used by hinge
>>> joints? I have a chain of bodies connected by hinge
>>> joints:
>>>
>>>
>>> for (int i = 0; i < NUM_SEGMENTS - 1; i++)
>>> {
>>>
>>> //create the joints
>>> Joints[i] = dJointCreateHinge
>>> (World,snake_joints_group);
>>>
>>> //attach joints to the body
>>> dJointAttach (Joints[i], Body[i], Body[i+1]);
>>>
>>> //place the joints
>>> dJointSetHingeAnchor (Joints[i], (i+1) *
>>>
>>> // joints are vertical
>>> dJointSetHingeAxis (Joints[i], 0.0, 0.0, 1.0);
>>>
>>> //allow large torques when setting velocities
>>> dJointSetHingeParam(Joints[i], dParamFMax, 1000);
>>>
>>> }
>>>
>>>
>>> My expectation would be for the joints to follow a
>>> right-hand rule, as
>>> I'm connecting from Body[i] to Body[i+1], and have a
>>> positively oriented
>>>   hinge axis.  When running my simulation, however,
>>> ODE seems to be
>>> using a left-hand rule.  Is this the expected
>>> behavior, and if so, is it
>>> documented somewhere?  All I've been able to find is
>>> the manual entry
>>> for dJointGetHingeAngle:
>>>
>>> "Get the hinge angle and the time derivative of this
>>> value. The angle is
>>> measured between the two bodies, or between the body
>>> and the static
>>> environment. The angle will be between -pi..pi.
>>>
>>> When the hinge anchor or axis is set, the current
>>> position of the
>>> attached bodies is examined and that position will
>>> be the zero angle."
>>>
>>> which gives no information about the sign
>>> convention.
>>>
>>> By right-handed, I mean that if I take Body[i] as my
>>> reference with my
>>> hinge axis as [0,0,1], then counter-clockwise
>>> rotations of Body[i+1]
>>> with respect to Body[i] should be considered
>>> positive angles.
>>>
>>>
>>> Thanks for any help,
>>>
>>> -Ross Hatton
>>> _______________________________________________
>>> ODE mailing list
>>> ODE at ode.org
>>> http://ode.org/mailman/listinfo/ode
>>>
>>
>>
>>
>> ____________________________________________________________________________________
>> Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.
>> _______________________________________________
>> ODE mailing list
>> ODE at ode.org
>> http://ode.org/mailman/listinfo/ode
>>
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://ode.org/mailman/listinfo/ode
>
```