RoboGeeks
EN
  • English
  • Español
  • Português
  • Deutsch
  • Français
  • Italiano
  • Русский
  • Українська
  • 繁體中文
  • 简体中文
  • 한국어
  • 日本語
  • ไทย
$
Log inJoin

What Is PID Control? | Understanding PID Control, Part 1

MATLAB · Uploaded · 11:41 · Watch on YouTube

Favourite
Follow the thread

A mail when somebody comments. No account needed.

Have an account? Log in and follow in one click.

A MATLAB Tech Talk host introduces feedback control of physical systems and the proportional, integral, and derivative paths of a PID controller. He uses a walking example and a drone altitude example to show why each path helps drive the error to zero.

Robots in this video: NicHub stewart-platform-esp32

Transcript

Captions as a .vtt fileEmbed with the transcript

  1. 0:00Let's talk about PID control. Chances are you've interacted with something that uses a form of this
  2. 0:07control law even if you weren't aware of it, and so it's worth learning a bit more about what this
  3. 0:12control law is actually doing and how it helps us. However, often when we're learning something new
  4. 0:18in control theory it's easy to get bogged down in the detailed mathematics of the problem. So in
  5. 0:23this video we're going to skip most of the math and instead focus on building a good intuitive
  6. 0:28foundation so I hope you stick around for it. I'm Brian and welcome to a MATLAB Tech Talk.
  7. 0:36We start with a plant. This is what we call the system that we want to control or the system
  8. 0:41whose behavior we want to affect. The input into the plant is the actuating signal and the output
  9. 0:47is the controlled variable. Different industries refer to these signals by various names so you
  10. 0:54might hear them called something else like plant input and plant output but regardless of the names
  11. 1:00the basic idea of a control system is to figure out how to generate the appropriate actuating signal
  12. 1:06the input so that our system will produce the desired controlled variable the output and that's
  13. 1:12basically the job of the control engineer produce the right input into the system to get the output that
  14. 1:17you want. And just like before the output you want also goes by various names. Here I call it the command
  15. 1:25or the commanded variable but you might also hear it as the set point the reference or the desired value.
  16. 1:32And in feedback control the output of the system is fed back hence the name and compared to the command
  17. 1:40to see how far off the system is from where we want it to be. This difference between the two is
  18. 1:46the error term. If the output was exactly what we commanded it to be then the error would go to zero
  19. 1:53and that is what we want. Zero error. So the question is how do we take this error term and convert it into
  20. 2:00suitable actuator commands so that over time the error is driven to zero? And the answer is with a controller.
  21. 2:09Let's illustrate this with an example. Imagine you are standing on the goal line of a soccer field and
  22. 2:15you want to walk to the half field line 50 meters away. In this case you are the plant. The actuating
  23. 2:23signal is the speed and the direction that you walk and your current location on the field is the output
  24. 2:29variable or zero meters to start and then 50 meters is the command. Therefore at the beginning your position
  25. 2:37error is 50 meters or 50 minus zero. You still have a ways to go. Your brain being the controller tells
  26. 2:44your legs how fast to walk and one way your brain can do this is to use the error at the present moment
  27. 2:51to decide your walking speed. Here I've set our controller to the value of 0.1. This means that
  28. 2:58if we take the error in our system and multiply it by 0.1 we'll get our walking speed. So if our error
  29. 3:04is 50 meters like it is at the beginning then we'll start off walking at 5 meters per second.
  30. 3:10With a proportional controller like this we start reducing the error quickly since we're far away
  31. 3:16and then gradually slow down as we get closer and closer to our goal. In this way we would
  32. 3:21eventually and asymptotically reach the half field line at which time the error would be zero and our
  33. 3:27proportional controller would multiply that by 0.1 which would generate a walking speed of zero stopping
  34. 3:34us right where we want to be. If we wanted to adjust the amount of time it took us to get to the goal
  35. 3:40we could increase or decrease the multiplier term. Regardless of the gain value chosen this type of
  36. 3:47controller will eventually cause us to stop right on the goal line. So this proportional controller seems
  37. 3:53great. I mean just multiplying the present error by a number seems to work. Well let's try it again
  38. 3:59on a different system and see if it performs the same way. In this second example you want to design
  39. 4:05an altitude controller for a quadcopter drone. The drone has four propellers and when they all spin up
  40. 4:11together they produce a force that lifts the drone up into the air. This is similar to our walking example
  41. 4:17in that we're trying to get to a specific location but this time we want to get our system to
  42. 4:23hover at an altitude of 50 meters. Our plant is the drone and the output of this system is altitude.
  43. 4:31Now the input of the system is not walking speed but propeller speed and all in all it seems like a
  44. 4:36pretty similar problem. So how well does a proportional controller work in this case? Well when the drone is
  45. 4:43on the ground there's an error of 50 meters which would generate a large propeller speed causing the drone to
  46. 4:50lift off and start to rise reducing the error. So far so good. But let's imagine the drone was able to
  47. 4:57rise all the way to 50 meters. What would happen now? Well the error would drop to zero since the command
  48. 5:04and the output are both 50 meters. This would then shut off the propellers. Lift would stop and the drone would
  49. 5:12fall back to earth. Now when that happens the propeller speed would start to increase again
  50. 5:17as the error grew. There is a certain propeller speed where the lifting force is exactly equal to
  51. 5:23the weight of the drone and at that speed the drone will hover. So where would our proportional
  52. 5:28controller hover this drone? Well that depends on the controller gain. Now let's assume for the moment
  53. 5:34that the propellers need to spin at 100 rpm in order for the drone to hover. If our proportional gain was
  54. 5:422 then the drone would hover right at ground level since an error of 50 times 2 is 100 rpm. However if we
  55. 5:51increased the gain to 5 the drone would rise at first but then stop at 30 meters since the error at that
  56. 5:58point would be 20 meters and 20 times 5 is 100 rpm. A gain of 10 would produce an error of 10 meters and a
  57. 6:06gain of 100 would produce an error of 1 meter. And no matter how high we increase the gain the error won't
  58. 6:12go away. It'll just get smaller and smaller with this system and a proportional controller. So we can see
  59. 6:18that a simple proportional controller doesn't work in every situation. It works with our walking example but
  60. 6:25for our drone it created this constant error. This error is also called steady state error.
  61. 6:31So how can we tweak our controller to get rid of this steady state error? We can do that by letting
  62. 6:37our controller use past information or specifically adding an integrator path in our controller that's
  63. 6:44added alongside the proportional path. An integrator sums up the input signal over time keeping a running
  64. 6:52total. Therefore it has this memory of what has happened before. Basically it's keeping track of
  65. 6:58the past. Now if the drone gets to steady state below the desired altitude the error term is non-zero.
  66. 7:06And when a non-zero value is integrated the output will increase. Now as long as there's error in our
  67. 7:12system the integral output will continue to change. And this increased value from the integrator path
  68. 7:19will increase the speed of the propellers and the drone will continue to rise. These two paths,
  69. 7:25the proportional and the integral path, work with each other to drive the error down to zero. And with
  70. 7:31this controller when the drone is hovering at the desired altitude of 50 meters, the proportional path
  71. 7:37is doing nothing since the error is zero. But the integral path has been summing and subtracting
  72. 7:43values until it came to rest at 100 rpm. Remember this is what we said was needed for the drone to
  73. 7:49hover. And that output from our integrator will not change since the input to the integrator at this
  74. 7:55point is zero. Alright, this proportional integral controller is it. This is what we want, right?
  75. 8:02Something that understands the present and has memory of the past. Well, looking at the past and present
  76. 8:08error will get us to our goal in this situation. However, the path the drone takes to get there
  77. 8:14might not be ideal. Imagine this situation. Right before we get to 50 meters there's an interesting
  78. 8:21situation that can occur. The proportional path is basically zero since at this point the error is so
  79. 8:27small. But depending on how the drone got to this height, the integrator may have summed to a value
  80. 8:32over 100 rpm. This would cause the drone to keep rising, which is what we want since we're below the
  81. 8:3850 meters. However, to remove that excess propeller speed, the drone will have to go higher than our
  82. 8:44goal to create a negative error. This negative error, when summed, lowers the output of the integrator
  83. 8:51and slows the propellers down. This overshooting of the goal might not be desired. Luckily, there is a
  84. 8:59simple way around this problem, and that is by adding a path to our controller that can predict
  85. 9:04the future and respond to how fast we're closing in on our goal. And we do that with a derivative.
  86. 9:12A derivative produces a measure of the rate of change of the error. That is, how fast the error is
  87. 9:18growing or shrinking. For example, if our drone is rising quickly and fast approaching our goal,
  88. 9:25this means that the error is quickly decreasing. That decreasing error has a negative rate of change,
  89. 9:32which will produce a negative value through our derivative path. That negative value will be
  90. 9:37added to our controller's output, therefore lowering the propeller speed. Basically, our controller is
  91. 9:44using changing error to determine that we are closing in on our goal way too fast, and then prematurely
  92. 9:50slowing down the propeller speed, preventing the drone from overshooting. And just like that, we've
  93. 9:57created a PID controller, proportional, integral, derivative. This is a versatile controller that
  94. 10:04uses the present error, the past error, and a prediction of the future error to calculate the
  95. 10:10appropriate actuator commands. These three branches each contribute some amount to the overall output of
  96. 10:16the controller. And as the designer, you get to decide how to weigh each contribution. You do this
  97. 10:23by adjusting the gain term in each branch. This is called tuning the controller. Now if your controller
  98. 10:30contains all three branches, it's called a PID controller. Now if the gain of one or more branch is
  99. 10:36set to zero, taking it out of the equation, then we typically refer to that controller with the
  100. 10:41letters of the remaining paths. For example, a PI or a P controller. PID is just one form of a feedback
  101. 10:50controller, but they're pretty easy to understand and implement. They are the simplest controller you
  102. 10:55can have that uses the past, present, and future error, and it's these primary features that are needed
  103. 11:00to satisfy most control problems. Not all, but a lot of them. That's why PID is the most prevalent form of
  104. 11:06feedback control for a wide range of real physical applications. Now there's a lot more to learn on
  105. 11:12this topic, and if you stick with this series, we're going to explore PID controllers in more detail.
  106. 11:17Now that we have a general understanding of what PID control is, we'll move on to how we implement one,
  107. 11:23how we tune it to do what we want, and we'll watch it in action on some real hardware. So if you don't
  108. 11:28want to miss these future tech talk videos, don't forget to subscribe to this channel. Also if you want
  109. 11:33to check out my channel, Control System Lectures, I cover more control theory topics there as well.
  110. 11:39Thanks for watching, and I'll see you next time.
Embed this video with its transcript

Paste this into your page. The frame holds the player and the transcript; the link below it says where the transcript comes from.

Discussion

You pick a name in the next step. Already a member? Log in.

The newsletter

Get our free newsletter with new robots, prices and robotics news.