PID Control: Present, Past, Future
By Amiro
A lesson of Control Theory
Transcript
- 0:00 How does a robot hit its target, again and again, in a messy real world?
- 0:06 With a feedback loop. A target goes in, a controller drives the robot, and sensors measure what the robot actually does, and feed it back.
- 0:15 Say the target speed is one metre per second. The robot is measured at zero point seven. The controller turns that into a motor command.
- 0:25 Here the two are compared. The error is reference minus output: one minus zero point seven, so zero point three. The error is what drives the controller.
- 0:37 Real robots get bumped and pushed, and their sensors are noisy. Feedback corrects for all of it, without even knowing the cause.
- 0:46 So what is actually inside the controller?
- 0:49 Very often, a PID controller. It turns the error into a command, by adding up three terms.
- 0:56 The P term looks at the present: the error right now. The I term looks at the past: all the error, added up over time. And the D term looks to the future: how fast the error is changing.
- 1:11 Let's test it. A robot joint has to move from zero to a target of one. The yellow curve is its position over time, and the block on the right is the robot itself.
- 1:22 First, P alone, with a gain of two. The push is proportional to the error. The joint moves, but settles short of the target. That leftover gap is the steady-state error.
- 1:35 Turn the gain up to eight. The gap shrinks, and the response gets faster.
- 1:40 But replay it, and look: now it overshoots the target, and wobbles before it settles. And there is still a gap.
- 1:49 Near the target, the error is small, so P only pushes weakly. The integral adds up this gap over time, and the longer it lasts, the harder it pushes.
- 2:00 Add I, and the gap is gone: the joint ends exactly on target. But the stored-up push makes it overshoot even more.
- 2:09 That is where D comes in. It watches the slope of the error. When the robot rushes towards the target, D sees it coming and brakes early, like a careful driver.
- 2:21 Add D, and look: a fast rise, almost no overshoot, and it lands exactly on target. Fast, accurate, and stable. That is PID.
- 2:33 Engineers often write the controller in the Laplace domain. Integrating becomes dividing by s, and differentiating becomes multiplying by s. So calculus turns into algebra, which is much easier to analyse.
- 2:48 So: P reacts to the present, I remembers the past, and D anticipates the future. Together they give a fast, accurate and stable response. The art is in balancing the three gains for your robot.
- 3:03 Here is the whole picture. The feedback loop measures the robot and computes the error. The PID controller turns that error into a command, with its three terms. And the results: P alone falls short, PI reaches the target but overshoots, and PID is fast, accurate and stable.
More explanations on Sifr