PID Proportional Integral Derivative Control Systems A presentation

  • Slides: 27
Download presentation
PID (Proportional, Integral, Derivative) Control Systems A presentation to the Robotics Society of Southern

PID (Proportional, Integral, Derivative) Control Systems A presentation to the Robotics Society of Southern California May 11, 2013 By Alex Brown rbirac@cox. net

Introduction PID is a method of controlling a dynamic system. It consists of 3

Introduction PID is a method of controlling a dynamic system. It consists of 3 simple calculations which are added together to generate a control signal to make your system track to a reference value. A tuned system gives the fastest response to an error. It doesn’t take a lot of math. Just testing to determine gains. It really only works well for simple linear systems; but its concepts can be applied to more complex systems.

Closed Loop Control System Reference Controller Control Signal Process E. g. motor, arm, temp,

Closed Loop Control System Reference Controller Control Signal Process E. g. motor, arm, temp, etc. E. g. PID Feedback

Control System for Robot Drive Motors Reference Forward Speed PID PWM MOTOR Feedback Tachometer

Control System for Robot Drive Motors Reference Forward Speed PID PWM MOTOR Feedback Tachometer or position encoder

Motor characteristics No Load “Normal” load Speed Heavy load Stall PWM 100% PWM Motor

Motor characteristics No Load “Normal” load Speed Heavy load Stall PWM 100% PWM Motor Speed Inertia Friction No load with load

P term (Proportional) PWM + Reference Forward Speed _ MOTOR Kp Feedback (Actual Speed)

P term (Proportional) PWM + Reference Forward Speed _ MOTOR Kp Feedback (Actual Speed) Speed Ref Bump 8 Speed Ref 4 0 8 4 0 2 PWM 1 PWM 0 Actual Speed 4 2 1 Hits bump 0 Actual Speed 8 4 0 Step change

I term (Integral) Error Reference Forward Speed + _ PWM + KP MOTOR +

I term (Integral) Error Reference Forward Speed + _ PWM + KP MOTOR + KI Feedback (Actual Speed) Speed Ref Error 8 4 0 2 0 Integrator Turn integrator on here Speed Ref Error 8 4 0 2 0 Integrator PWM Actual Speed 4 2 Hits bump

Integrator Windup Speed Ref 4 0 Kp Integ 300+ 50 PWM 100 Actual Speed

Integrator Windup Speed Ref 4 0 Kp Integ 300+ 50 PWM 100 Actual Speed 50 4 2

Integrator Windup (cont. ) Reference Forward Speed + _ Rate KD KP + _

Integrator Windup (cont. ) Reference Forward Speed + _ Rate KD KP + _ + PWM MOTOR KI Stop LOGIC Example logic: stop if total PWM is >= 100 and error is polarity to increase integrator. Stop if actual speed is converging with reference value stop if it is known that integrator will cause subsequent error.

D term (Derivative) Rate Reference Forward Speed Ref Error _ _ + KP +

D term (Derivative) Rate Reference Forward Speed Ref Error _ _ + KP + PWM MOTOR KI 8 4 0 2 0 Kp Rate PWM Actual Speed + KD 4 2 Feedback (Actual Speed)

PID PROs Kp KI KD PID Removes short term errors quickly Removes long term

PID PROs Kp KI KD PID Removes short term errors quickly Removes long term errors CONs Doesn’t remove long term errors Has a fixed time constant Removes errors very slowly. May cause integrator windup. Improves short term stability. Sometimes is NECESSARY depending on what is being controlled. Acts as above providing optimally fast response to errors Don’t have to use all the terms. We don’t always want optimally fast responses.

Is that all there is? In theory, a PID controller can succeed for any

Is that all there is? In theory, a PID controller can succeed for any system that is linear. However, it may not perform just the way we would like. A pure PID system works best on a linear system with a slow moving reference or small reference changes. That’s no fun! We want our robots to respond quickly but smoothly to large changes of command. And our robot systems usually have many non-linearities. I worked on autopilot design for 30 years and never heard the word “PID” until I retired and started on robots. Our autopilots used one or more of the three PID terms at appropriate times usually with logic and/or other devices to achieve good performance in the real world.

Slow response to speed reference change As indicated earlier, a PI drive motor system

Slow response to speed reference change As indicated earlier, a PI drive motor system will not quickly achieve the new reference speed until the integrator runs long enough to command the necessary additional PWM. We know that under normal conditions, there is a proportion between speed and PWM. Hence another term may be added (a “Feed. Forward” term) that approximates the PWM required at any commanded speed. This will usually provide much faster approach to the new reference and leave the integrator to only pick up any residual error. KFF Rate Reference Forward Speed + _ KP _ + KP + KI + PWM MOTOR

KP + KI + KFF KP Only 8 Speed Reference 4 0 error 100

KP + KI + KFF KP Only 8 Speed Reference 4 0 error 100 Integrator 40 0 KFF 100 40 0 100 PWM KP + K I

Loops within Loops Outer loop Middle loop PID feedback E. g. Navigation This may

Loops within Loops Outer loop Middle loop PID feedback E. g. Navigation This may be the slowest response loop. Maneuvers vehicle smoothly. E. g speed and steering. Can be slower than servo loop. Servo loop or inner loop. PID Motor feedback Fastest loop. Moves motor/actuator to desired speed/position quickly.

Trapezoidal Speed Profile Speed Reference PID tracking Stopped Constant acceleration speed Constant Stopped deceleration

Trapezoidal Speed Profile Speed Reference PID tracking Stopped Constant acceleration speed Constant Stopped deceleration You can eliminate much of the PID tracking lag by adding an acceleration feed-forward term. Acceleration using this method works well. Deceleration is challenging due to the difficulty of determining when to begin slowing at a constant acceleration to stop at a target distance. My method is to continuously calculate the accel required to stop by the target distance. When that accel is >= desired deceleration, switch to controlling to the calculated accel and vary plus or minus to stop at target distance.

Application to real robots. Differential: MOTOR Reference Forward Speed PID PWM MOTOR Actual Speed

Application to real robots. Differential: MOTOR Reference Forward Speed PID PWM MOTOR Actual Speed PID PWM Average MOTOR Reference Forward Speed MOTOR Both will work to hold forward speed, but both will have poor directional control with nothing to keep them in sync.

Need an upstream steering system like the below Reference Forward Speeds Reference Fwd Speed

Need an upstream steering system like the below Reference Forward Speeds Reference Fwd Speed + Steering Left wheel Right wheel PID PWM MOTOR Or, a downstream “equalization” system as below Reference Forward Speed _ PID MOTOR + _ PWM + MOTOR Actual Speed Average But, it is still going to require steering someday.

Ackerman Steering forward speed control Reference Forward Speed PID PWM MOTOR Actual Speed Forward

Ackerman Steering forward speed control Reference Forward Speed PID PWM MOTOR Actual Speed Forward speed control is independent of steering

Or, as I prefer, an upstream steering system AND modifying the PID loop to

Or, as I prefer, an upstream steering system AND modifying the PID loop to control position (or distance) rather than speed. Common Reference Fwd Dist + Steering Reference Forward Distance Left wheel Right wheel PID PWM MOTOR Advantages: Simple PID loop. Only requires Kp. Very accurate dead reckoning of distance and steering. No integrator windup concerns. Minor distance offset will supply any PWM needed up to 100% Disadvantages: Requires feedback to Distance loop to ensure distance commands do not exceed motors ability to follow.

Reference Forward Distance Speed and Accel Left wheel Accel. Ref Common Reference Fwd Dist

Reference Forward Distance Speed and Accel Left wheel Accel. Ref Common Reference Fwd Dist + Steering Dist. Ref Speed. Ref + _ KFFacc + Kp KFFspd PWM MOTOR + Right wheel Same as above Speed error Target fwd speed + Maximum accel PWM MOTOR Reference accel Reference speed Reference distance Accel limiter Calculate accel to stop at target distance Generate Trapezoidal speed profile Logic to begin decel

Steering Control We have two type of steering systems commonly used. Differential Drive Ackerman

Steering Control We have two type of steering systems commonly used. Differential Drive Ackerman Steering

Target distance Error Steering Task Wall Following Measured distance Target distance Error Measured distance

Target distance Error Steering Task Wall Following Measured distance Target distance Error Measured distance

Lateral Error + KP Rate KP Steering displacement KD + _ Steering displacement +/-

Lateral Error + KP Rate KP Steering displacement KD + _ Steering displacement +/- commands to L & R motor control loops Angle command to steering servo

Lateral Error Limiter 45 deg KP + Steering displacement Error

Lateral Error Limiter 45 deg KP + Steering displacement Error

Rate Lateral Error ? KP KD _ + Error

Rate Lateral Error ? KP KD _ + Error

Conclusion Pure PID is best for inner loop where you want fast response. Even

Conclusion Pure PID is best for inner loop where you want fast response. Even there just use the terms necessary to get the performance you want. Use the P, I & D terms freely in designing outer loop navigation when you want your control to converge on a steady reference exponentially. For more info on pure pid, google pid tutorials For more of my slant on it, try abrobotics. tripod. com. It includes a simulation program written by (ex) clubmember Lior Elazary.