Move the sliders, run the simulation, and find out what each gain does.
The problem
A robot lift must raise a load from the floor to a height of 1.0 m and hold it there. Gravity pulls the load down. A PID controller decides how hard the motor pushes. Right now its three gains are badly tuned.
Change Kp, Ki and Kd, press Run simulation, and compare the new response with the previous one (the dashed line).
The control loop
u = Kp·e + Ki·∫e dt + Kd·de/dt
e = target − position
What the three gains look at
Kp: the error right now
The proportional term pushes in proportion to how far the lift is from the target at this instant.
Ki: the error added up over time
The integral term keeps a running total of the error. The longer an error lasts, the larger this total becomes.
Kd: how fast the error is changing
The derivative term responds to the rate of change of the error, so it reacts to the lift's speed rather than its position.
Words used in this lab
Overshoot
How far the lift goes above the target at its highest point, as a percentage of the target height.
Settling time
The time after which the lift stays within ±2 cm of the target for good.
Steady-state error
The distance left between the lift and the target once the motion has died out. Shown as “final error”, averaged over the last second.
Oscillation
The lift swinging back and forth across the target instead of settling.
Control effort
How hard the motor works overall: the root-mean-square of the motor command u. The motor cannot deliver more than ±20.
Starting controller
this run previous run target 1.0 m ±2 cm band
Control input u (motor command)
Error e = target − position (m)
–Overshoot
–Settling time
–Final error
–Control effort
–Score
PID controllerRuns in your browser
Feedback
Run the simulation to see how this controller behaves.
Hints
How to tune a PID controller for a robot
PID control is the most widely used feedback method in robotics: joint position loops, wheel speed control, drone attitude, heating and more. Its three gains are easy to change and surprisingly easy to get wrong. This lab lets you build intuition by experiment: every change you make is simulated immediately, and the plots show exactly how the response changed.
A practical manual procedure used by many engineers:
Start with only proportional action and find a gain that makes the system respond at a useful speed.
Add derivative action until the overshoot and oscillation are under control.
Add a small amount of integral action to remove what is left of the steady-state error.
Check the control effort: a controller that constantly saturates the motor is not a good controller, even if the plot looks fine.
The lab scores your controller on the actual simulated response, not on particular gain values. Many different combinations of Kp, Ki and Kd pass.
What you will learn
What proportional, integral and derivative action each respond to.
How to read overshoot, settling time, steady-state error, oscillation and control effort from a step response.
Why tuning is always a trade-off between speed, accuracy, smoothness and effort.