[ODE] hexapod walking example
Adam Rotaru
adam_rotaru at yahoo.com
Fri Dec 28 18:32:01 2001
Hi Nate, thanks for your reply.
Here's some more on applying torques for controlling
joints.
--- Nate W <coding@natew.com> wrote:
> In a nutshell, something like this?
>
> error = (desired_position - actual_position)
> torque = gain * error
Yes. To add some more detail:
- the deviations (and torques) are capped at a
maximum value, to prevent VERY large torques.
- as the exerted torque is proportional to the
deviation, ideally there is a deviation value where
the torque
will equal the resistance (provided the resistance is
smaller than the maximum torque value)
- I also distinguish between a minimum and maximum
desired position,
and a narrow range between them, where I don't apply
any torques.
This is inspired by the idea of two reflexes:
if angular position is larger than th1, then push
leg down,
if angular position is smaller than th2, raise leg
up.
- some damping is also incorporated
Also I'd like to stress that my pattern generator
has no feedback whatsoever. In a more sophisticated
solution you would use feedback from current tensions
in muscles/joints to set the applied torques.
The actual code for the segment1-body joint:
(all angles in radians)
desPos -- the desired position
hiLimit = 0.4 + 0.9*desPos;
loLimit = 0.0 + 0.9*desPos;
p = dJointGetHingeAngle(joint2);
z = -0.03*dJointGetHingeAngleRate(joint2);
if (p < -hiLimit) z += (-hiLimit - p);
else if (p > -loLimit) z += (-loLimit - p);
if (z > 0.5) z = 0.5;
if (z < -0.5) z = -0.5;
to[0] = 0.0050*z;
to[1] = 0;
to[2] = 0;
dBodyAddTorque(dummy, to[0], to[1], to[2]);
dBodyAddTorque(leg1.body, -to[0], -to[1], -to[2]);
> If that doesn't work for my app, I am
> considering integrating
> the error over time, so the feedback function will
> have a proportional
> term and an integral term, like this:
> The idea behind the integral term is to make the
> feedback increase over
> time if the joint remains deviated from the desired
> position.
This sounds like an interesting idea!
> Stick with the proportional feedback fuction and try
> this... set two gains
> for the feedback equation, a small and a large.
> When applying torque in a
> direction that would lift the body, use the large
> gain. When applying
> torque in a direction that would left the foot, use
> the small gain.
Unfortunately its more complicated than this.
In the horizontal plane, the torque applied points
backwards, to push the body forward. The problem is
the contact between the end of the leg and floor is
sometimes established, sometimes not. When the
contact is
broken (because the end of the leg is happened to lift
a
bit), the leg moes freely, and swings back. Sometimes
its
free, sometimes it's not, but it always moves in the
same
direction.
Another subtility. If you consider that a torques is
created by
a force exerted by a muscles in a point, the torque
can vary even
if the exerted force is the same. As torque is the
product of the force
and the perpendicular distance from the fulcrum, the
same force
produces different torques depending on the current
angle of the joint.
I'm thinking this effect is worth incorporating.
cheers,
Adam
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com