Presentation is loading. Please wait.

Presentation is loading. Please wait.

PID Control Systems (Proportional, Integral, Derivative)

Similar presentations


Presentation on theme: "PID Control Systems (Proportional, Integral, Derivative)"— Presentation transcript:

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

2 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.

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

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

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

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

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

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

9 Integrator Windup (cont.)
Rate KD _ PWM Reference Forward Speed + KP + 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.

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

11 PID PROs CONs Kp KI KD PID Removes short term errors quickly
Doesn’t remove long term errors Kp Has a fixed time constant Removes long term errors Removes errors very slowly. May cause integrator windup. KI KD Improves short term stability. Sometimes is NECESSARY depending on what is being controlled. PID 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.

12 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.

13 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 “FeedForward” 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 KP _ + PWM Reference Forward Speed + KP + MOTOR _ + KI

14 KP + KI + KFF KP Only KP + KI KFF 8 Speed 4 Reference error 100
error 100 Integrator 40 100 KFF 40 100 PWM

15 Loops within Loops Outer loop Middle loop Servo loop or inner loop.
PID PID PID Motor Motor feedback 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. Fastest loop. Moves motor/actuator to desired speed/position quickly.

16 Trapezoidal Speed Profile
PID tracking Speed Reference Stopped Constant acceleration Constant speed Constant deceleration Stopped 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.

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

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

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

20 Or, as I prefer, an upstream steering system AND modifying the PID loop to
control position (or distance) rather than speed. Reference Forward Distance PWM Common Reference Fwd Dist + Steering PID MOTOR Left wheel PWM PID MOTOR Right wheel 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.

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

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

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

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

25 Steering displacement Lateral Error Limiter 45 deg + KP Error

26 Rate KD ? _ Lateral Error KP + Error

27 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.


Download ppt "PID Control Systems (Proportional, Integral, Derivative)"

Similar presentations


Ads by Google