# [ODE] Better way to find 'Desired Velocity'

Andrew Schroeder schroe2a at gmail.com
Fri Jan 28 16:16:45 MST 2005

I'm thinking that the equation

DesiredVelocity = Error * Gain

is actually NOT a simple P-Gain situation that you are saying I should
start with.  I think this because the Input (Error) is in POSITION,
and the output is in VELOCITY, thus with the above equation we
actually set an Integrated Controller, we have a simple I-Gain,
Is my thinking correct on this? If so is there a way to create a
simple P-Gain like you suggest without setting the position directly?
(obviously I don't want to set the position of my ode bodies directly)

If my setpoint was a velocity then I would say the equation was a
P-Gain, but it's a position.

On Fri, 28 Jan 2005 15:08:00 -0600, Royce Mitchell III <royce3 at ev1.net> wrote:
> Andrew Schroeder wrote:
>
> > Before you mentioned it, i'd never heard of a PID controller at all.
> >I've spent the past couple hours reading up.
> > Maybe some of you who understand both ODE and PID controllers could
> >help me relate what I've learned about PID's to how they could be
> >useful in ODE Joint control...
> > I think the controller in the servo approach in the ODE Wiki FAC:
> >
> >DesiredVelocity = -Error * Gain
> >
> >is like a PID controller where only the 'I' part is set to Gain, and
> >the 'P' and 'D' params are 0.  This makes sense because the above
> >equation is what they give for a 'I' only controller, and the behavior
> >typical of a PI controller what we see from the above servo model.
> > The problem with a PI controller is most evident when the 'deadtime'
> >is high.  For us this means that the max-force is low and it takes
> >awhile to get up to speed. (or to stop) To deal with this a PID
> >controller would set a 'D' or Derivative control element which removes
> >the oscillation caused by delayed application of your output.  To add
> >another term to the servo approach:
> >
> >DesiredVelocity = -Error * iGain + dGain * (Error-ErrLast*2+ErrLastLast)
> >
> >or something like that.  Here the new dGain value would be the 'D'
> >part of a PID and would serve to slow down the body sooner by keeping
> >track of how much the error is changing.
> > Does this make sense, and is it consistent with the your
> >understanding of a PID controller?  Anyone have a better guess at the
> >correct way to do the above equation?
> >
> >Further clouding the issue for me is the fact that our Process
> >Variable is Position of the body, but we only actually effect the
> >Velocity, (and even that indirectly by setting a desired velocity and
> >letting the joint motor bring it to speed.)
> >
> >Finally, if I am on the right track with adding the dGain term to the
> >DesiredVelocity equation, wouldn't a good value for dGain be related
> >to the maxForce of the joint?
> >
> >Thanks,
> >Andy
> >
> >
> >
> You should try starting with simple P-Gain, and get it working as well
> as you can with only that. Less than 5% of applications need I or D, so:
>    DesiredVelocity = Error * pGain
>
> You shouldn't need to -Error, instead you should reverse how you're
> calculating Error...
>
>