[ODE] Servo to reach a target position

Russ Smith russ at q12.org
Fri Apr 11 00:04:02 2003


> IIRc, Russ even went so far as to say that it's better than perfect -
> it can effective "see" one time-step into the future.

let me say how i see things with regard to joint control, PID controllers,
etc.

in the real world, PD and PID control are extremely useful. they're
among the simplest forms of control but they are very effective for many
problems. because they only have two (or three) user-settable parameters,
these parameters can be tuned by hand, through trial and error. although
there are mathematically precise ways to select the PD/PID parameters,
these methods require an exact model of the system that you are
controlling - this is often not available. so most users will simply play
with a bunch of different parameters ("turning the knobs") until the
thing works.

PID control can, under some circumstances, provide better (higher order)
control of certain systems than PD. but this comes at a price. obviously
there's an extra parameter to tune, so it takes longer to find a workable
solution. but more importantly, the integral term in the control equation
introduces a state variable (call it 'I', the integrated error) into your
controller where proviously there was none. this opens a whole can of
worms. you have to make sure 'I' does not go out of bounds, and you have
to provide ways to reset 'I' under various exceptional conditions. your
whole system becomes more complex, and you need a much better
understanding of the thing you are controlling to be able to show that
the controlled system is robust. this is why many people are reluctant to
use PID when PD will do.

now how is this relevant to ODE? PD/PID control systems can be used to
control the 'motor' force applied to a joint, such that the joint achieves
a certain angle or position. there's nothing intrinsicly wrong with this -
it matches what you might do in the real world with a real motor and
joint. however, in ODE there is a better way to get the same effect.
simply set the 'motor' parameters on the joint: the desired velocity and
fmax. at each time step, ODE will try to achieve the desired velocity at
the joint by applying up to force fmax. if the force applied is less than
fmax, then you will get the desired velocity at the *next* time step. if
the force is clamped at fmax then you wont get the velocity you asked for,
but ODE will have done its best to get there - for example it may take
several time steps for the velocity to ramp up to the desired value.

ODE's motor facility has a number of advantages over applying forces
directly. first, it is way more stable - the direct application of forces
based on control equations can cause instability if the control equation
is too stiff. second, it takes away the burden of having to compute the
controlling force yourself (tuning those parameters takes time).
ODE magically works out the correct force to achieve the desired velocity
in one time step, something that your force-based control equation might
take many time step to do. ODE's motors are also a reasonable model of
highly geared servo motors (e.g. like the little position controlled
servos that you find in remote controlled cars), so there is *some*
physical justification for using them.

of course you are still free to apply computed forces for other reasons.
but if all you want is good velocity control, for many applications ODE's
motors will do the job better.

russ.

--
Russ Smith
http://www.q12.org/