Shop OBEX P1 Docs P2 Docs Learn Events
PID Question on deceleration — Parallax Forums

PID Question on deceleration

T ChapT Chap Posts: 4,223
edited 2012-12-26 16:30 in Propeller 1
On a motor with an encoder and a PID loop controlling the motor driver based on the error, there is a problem with the deceleration in conditions of the motor/encoder overshooting the destination position during decel. With a motor that is loaded, this is usually not a problem. But there is a fine line ( narrow gap ) between having not enough torque to run the motor well ( Integral wind up max ), and too much torque causing jerky motions. When the integral max is perfect, all things work well, nice accel, decel, no overshooting. The problem of overshooting on decel is when the motor driver ( Prop pin ) toggles the direction back and forth rapidly, so the motor sounds like it is pulsing or knocking until it stabilizes. I have spent a lot of time experimenting trying to find a solution. Any attempts to reset the integral max on an undesirable direction change causes the motor to then revert to several short motions during the decel, since the windup is starting over from A. scratch, or B. starting over from some reduced windup factor. In either case, the drop in output is always noticeable and not acceptable. Then, attempts to disallow direction pin flops during decel are problematic, since what if the pin flop was intention by the main program wanting a reverse during the decel. I think some intervention of the PID loop from the main program may be able to tell the PID loop what is a genuine reverse, and override any measures the loop is taking to prevent pin flip flops on decel.

This is the essence of the direction control:
If position -  encoderposition > 0     ' 0 is not allowed     position is the destination from the master
   outa[26]~   'direction pin
else of position - encoderposition < 0     ' 0 is not allowed
   outa[26] := 1  'direction pin

I do not think the reversing is required to assist the system in deceleration, nor does it help in hitting the encoder line (destination position) since there is enough inherent friction.

The goal is to decel with no direction output changes UNTIL arriving at the destination(ie within 125 encoder counts). But the reverse must be available for intentional cases.

Any ideas?

Comments

  • MicksterMickster Posts: 2,694
    edited 2012-12-26 16:30
    Hmmm, not sure I fully grasp the problem but are you able to configure your amp for anti-phase PWM (I config 18200s this way)? Using this method doesn't involve any direction pin as a 50% duty cycle produces zero output from the amp, 0% duty = full current in the negative direction and 100% duty = full current output in the positive direction. For industrial grade servo amplifier compatibility, this same signal is typically filtered to produce the standard +/- 10v motor command.

    Mickster
Sign In or Register to comment.