Work in progress: this PID racerbot resource is still being refined. The simulators are educational models and
may continue to receive behavior and calibration updates.
SFU Racerbot Educational Resource
Interactive PID Visualizer for Learning and RoboRacer Wall-Following
This webpage is a hands-on learning tool for understanding PID control. You will start with a simple
general-purpose simulator to learn what the proportional, integral, and derivative terms do. Then you will
explore a RoboRacer wall-following visualizer that shows how similar control ideas help a small racecar stay
aligned with a wall or target path.
No prior PID knowledge should be assumed.
PID Foundations
What the PID Formula Means
The controller compares what we want to what we have. The difference is error. PID turns that error into a correction command.
PID Equation
u(t) = Kp · e(t) + Ki · ∫e(t)dt + Kd · de(t)/dt
u(t): control output sent to the system.
e(t): error = setpoint − measured value.
Kp: reacts to current error (faster response, can overshoot if too high).
Ki: reacts to accumulated past error (removes offset, can wind up).
Kd: reacts to how fast error changes (adds damping, helps reduce oscillation).
Changing Kp
Setpoint Low Kp Medium Kp High Kp
Higher Kp usually rises faster, but too much Kp can create oscillation and overshoot.
Changing Ki
Setpoint Low Ki Medium Ki High Ki
Ki removes steady-state error, but too much Ki can produce slow recovery and extra overshoot.
Changing Kd
Setpoint Low Kd Medium Kd High Kd
Kd adds damping. It can smooth the response and reduce overshoot when tuned reasonably.
General PID Simulator
Learn PID from Scratch
Goal: move the output to the setpoint. The controller compares what we want to what we have. The difference
is called error.
Main Response Plot
Setpoint Actual response
Time (s)
This chart shows whether the process variable reaches the target and how much it overshoots.
Error Plot
Time (s)
A good controller drives error toward zero and keeps it near zero.
P, I, D Contribution Plot
P I D Total
Time (s)
Use this view to see which PID term is doing most of the work at each moment.
Error
0.00
Integral
0.00
Derivative
0.00
P contribution
0.00
I contribution
0.00
D contribution
0.00
Total control
0.00
Overshoot
0.0%
Settling status
Not settled
RoboRacer Wall-Following Simulator
Projected Error and Steering Control
Goal: keep the car near a target wall offset and aligned with the wall direction. The projected error helps the
controller act earlier instead of correcting too late.
Top-Down Wall-Following Scene
x-axis: meters (m) | y-axis: meters (m)
Arrow shows steering command. The projected point shows where the car is heading soon.
Lateral error y
0.00
Heading error theta
0.00 rad
Projected term L·sin(theta)
0.00
Controller error e
0.00
Steering command
0.00 rad
Mode
Projected error
Crash Status
No collision
Lidar-Inspired Teaching Panel
Two conceptual rays estimate wall orientation and projected wall distance.
RoboRacer x VESC Speed Control
VESC-Style Cascaded Speed PID Simulation
This simulator mirrors common VESC behavior used on 1:10 racecars: an outer speed PID in ERPM commands
motor current, while the current loop and motor physics determine wheel speed. It includes ERPM ramping,
minimum ERPM release logic, derivative filtering, and speed estimator mode differences.
Speed Tracking
Target speed Actual speed Estimated speed source
Time (s)
The estimated trace is the speed feedback used by the PID loop (PLL/FAST/FASTER).
Current and Duty Cycle
iq setpoint iq actual Duty (x40)
Time (s)
Speed PID output maps to iq current; motor back-EMF and battery voltage shape duty headroom.
P, I, D Output (Normalized)
P I D Total
Time (s)
Mirrors VESC-style scaling where PID output is clamped before converting to current command.