Unit 06 · lesson
Feedback Control: Setpoint, Measurement, Error
Closed-loop control uses measurement to correct action.
The basic loop is:
setpoint
↓
compare with measurement
↓
error
↓
controller
↓
actuator output
↓
mechanism changes
↓
sensor measurement returns
The loop repeats.
The three values you must separate
Setpoint
Where you want the system to be.
Measurement
Where the sensor says the system is.
Error
The difference between them.
If an elevator target is 1.20 m and the measured position is 0.95 m:
error = 1.20 - 0.95 = 0.25 m
The controller uses that error to decide what output should happen next.
Proportional control
A proportional term increases control effort as error increases.
Conceptually:
output = kP × error
Large error produces larger correction. Small error produces smaller correction.
Too little proportional response can feel weak or slow. Too much can create overshoot or oscillation.
Integral and derivative are not “make it better” knobs
PID adds integral and derivative terms, but more terms do not automatically mean better control.
Integral accumulates error over time and can help with persistent offset, but it can also wind up and create overshoot.
Derivative reacts to how quickly error changes and can add damping, but it is sensitive to noisy measurements.
WPILib provides PID tools, but tuning still requires understanding the mechanism.
Worked trace
Target angle: 90°
Measured angle: 60°
Error: 30°
Later:
Target: 90°
Measured: 82°
Error: 8°
Later:
Target: 90°
Measured: 91°
Error: -1°
A closed-loop controller should respond differently at each point because the error changed.
A fixed motor output cannot make that distinction.
Tolerance
Real mechanisms do not need infinite precision.
Define a tolerance that matches the task.
A shooter angle may require tighter control than a mechanism that only needs to clear a frame member.
A useful success condition is:
measurement remains within the allowed tolerance for the required amount of time under the expected load.
That is stronger than “it touched the setpoint once.”
Control-loop worksheet
For one mechanism, identify:
- setpoint;
- measurement;
- units;
- error;
- output;
- disturbance;
- tolerance;
- one safety limit.
Then draw the loop.
Failure mode: controlling bad data harder
If the sensor is inverted, mis-scaled, disconnected, or measuring the wrong shaft, higher control gains can make the system fail faster.
When a loop behaves wildly, confirm the measurement and direction before tuning.
The controller trusts the numbers you give it.