[ODE] Servo motor and getHingeAngle range
Julien BIBOLLET
julien.bibollet at gmail.com
Wed Nov 22 04:30:51 MST 2006
Hi,
I'm using ODE to build a robot simulation.
I use following code (from ODE's FAQ) to simulate servos:
> dReal Gain = 0.1;
> dReal MaxForce = 100;
>
> dReal TruePosition = dJointGetHingeAngle(joint);
> dReal DesiredPosition = /* whatever */;
> dReal Error = TruePosition - DesiredPosition;
>
> dReal DesiredVelocity = -Error * Gain;
>
> dJointSetHingeParam(joint[a], dParamFMax, MaxForce);
> dJointSetHingeParam(joint[a], dParamVel, DesiredVelocity);
>
the problem is that i have a motor whose range is -220° <-> 20°, initialy
positionned at angle 0°.
As the getHingeAngle returns an angle between -PI and PI, this one has huge
problems when the DesiredPosition is near and less than -180°.
I think that to resolve my problem, I should set an offset at beginning, so
that my angles would be in range -120° <-> 120° (meaning recentering at the
middle of the range).
But in my simulation, it's not easy to do this, since I would need to
rebuild all my robot.
So, is it possible, after building the body and joint tree, to specify that
angle of the Hinge is not 0, but a given offset (and then, I will subtract
this offset to the result givent by dJointGetHingeAngle to get correct
angle).
Or does anyone have an idea of how to build a servo motor without the -PI PI
range, or any other ideas ??
Thanks a lot for any help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20061122/428640ee/attachment.htm
More information about the ODE
mailing list