06 / PID and Feedforward
PID Basics
Understand setpoint, measurement, error, and proportional control before tuning.
06 / PID and Feedforward
Understand setpoint, measurement, error, and proportional control before tuning.
You will
This lesson is about feedback and prediction. Students should understand target, measurement, error, output, and the difference between reacting to error with PID and predicting required effort with feedforward.
A feedback controller repeatedly compares where a mechanism should be with where it is. The error becomes an output command. Students should understand that loop before touching tuning constants.
Start with P because it reacts to current error. Add D when oscillation needs damping, and use I only when a persistent small error truly matters.
Begin with a safe, slow, observable mechanism. Graph target, actual value, error, and output. Tune one idea at a time: proportional response first, damping second, feedforward when the team can describe the physical effort the mechanism needs.
For this specific lesson, students should first restate the goal in robot terms, then identify the value or behavior they expect to observe, then run the smallest test that proves the idea. The lesson should feel like a guided lab: predict, run, observe, explain, and only then extend.
SimplePController.java · Java
double targetTicks = 1200;
double kP = 0.004;
int position = lift.getCurrentPosition();
double error = targetTicks - position;
double output = kP * error;
output = Math.max(-1.0, Math.min(1.0, output));
lift.setPower(output);
telemetry.addData("target", targetTicks);
telemetry.addData("position", position);
telemetry.addData("error", error);
telemetry.addData("output", output);Control bugs come from both code and physics. A bad encoder sign, sticky mechanism, saturated output, or impossible target can look like a tuning problem. The lesson should teach students to inspect measurements and constraints before increasing gains.
Check your understanding
What is PID error?
0 of 1 answered
References
Finished reading?
You'll move on to “Feedforward and PIDF” next.