PID control, by feel
Welcome back. Last time we closed the loop: we measured the motor instead of trusting a timer. Today we decide how hard to push, using three simple ideas.
SLIDE 1 · PID CONTROL, BY FEELWelcome back. Last time we closed the loop: we measured the motor instead of trusting a timer. Today we decide how hard to push, using three simple ideas.
SLIDE 2 · THE JOB: HOLD A MOTOR AT 90°Everything today is about one number, the error. If the target is 90 degrees and we are at 60, the error is 30. The controller turns that error into a motor command.
SLIDE 3 · THE LOOP WE ARE TUNING
SLIDE 4 · P: PUSH IN PROPORTION TO THE ERRORProportional is the obvious one. Far away, push hard. Close, push gently. The catch: near the target the push gets too small to beat friction, so P alone can stall just short.
SLIDE 5 · SAME MOTOR, THREE CONTROLLERS
SLIDE 6 · I: REMEMBER THE ERROR THAT’S LEFTIntegral is memory. If we have been a little short for a while, the sum grows and pushes us the rest of the way. If the motor is stuck, the sum keeps growing. That is windup, and we clamp it.
SLIDE 7 · D: REACT TO HOW FAST THE ERROR CHANGESDerivative looks at the slope. Rushing toward the target? Ease off early. It is the reason a tuned robot glides in instead of bouncing. Noisy sensors make D twitchy, so we smooth it.
SLIDE 8 · YOUR TURN: TUNE ITPlay with the sliders. Start with Kd at zero and watch the overshoot. Then add Kd and see it calm down. Aim for under 10 percent overshoot and settling under 3 seconds.
SLIDE 9 · PID IN TWELVE LINESThis is the whole controller. Notice the integral is clamped, and the derivative is skipped on the first call so we do not get a huge kick.
SLIDE 10 · TUNING BY FEEL, IN FOUR STEPSThis is the routine I use on real robots. It is not optimal, but it is safe and it works in a few minutes.
SLIDE 11 · QUICK CHECKTake a guess before revealing. The wobble is a sign we are arriving too fast, and that is the derivative term’s job.
SLIDE 12 · WHAT TO REMEMBERThat is PID. Next lecture we do this on a real motor, where sample time, windup and noise stop being theory.