WestlakeLEARN
FTC / Java

First Tech Challenge

FTC / Java

01 · Java for FTC
  • OpMode Anatomy and Hello Robot
  • Variables, Math, and Decisions
  • Methods, Classes, and Robot Helpers
02 · FTC Hardware Essentials
  • Hardware Map and RobotHardware
  • Motors, Servos, and Sensors
  • IMU, Encoders, and Bulk Caching
03 · TeleOp and Mecanum
  • Robot-Centric Mecanum Drive
  • Field-Centric Driving
  • Driver Ergonomics and Safe TeleOp
04 · Subsystems and Commands
  • Subsystem Lifecycle
  • Enums and Finite State Machines
  • Command-Based OpModes
05 · From Timed Steps to Actions
  • Timed and Encoder Autonomous
  • Autonomous State Machines
  • Actions and Sequencing
06 · PID and Feedforward1/3
  • PID Basics
  • Feedforward and PIDF
  • Dashboard Tuning Workflow
07 · Motion Profiling
  • Motion Profile Concepts
  • Implementing a Profiled Mechanism
  • Testing Profiles and Failure Modes
08 · OpenCV and AprilTags
  • VisionPortal Camera Setup
  • OpenCV Color and Region Processors
  • AprilTags and Field Pose
09 · Setup and Tuning
  • Road Runner 1.0 Install and Drive Class
  • Feedforward Tuning
  • Localization and Validation
10 · Trajectories, Actions, and MeepMeep
  • Action Builder and Trajectories
  • MeepMeep Preview
  • Full Road Runner Autonomous
11 · Git, Debugging, and Competition Readiness
  • Git Workflow for FTC Teams
  • Telemetry-First Debugging
  • Competition Readiness Checklist
12 · Driver Control
  • Driver Control
13 · Autonomous Build
  • Simple Autonomous
14 · Debugging
  • Debugging with Telemetry

06 / PID and Feedforward

PID Basics

Understand setpoint, measurement, error, and proportional control before tuning.

65 minControlPID and Feedforward

You will

  1. 01Define setpoint, measurement, error, and output.
  2. 02Explain what P, I, and D terms do.
  3. 03Start tuning with proportional control only.

Why PID Basics matters

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.

Starting point

PID is a feedback loop

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.

Tune one term at a time

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.

Build path

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);

Debugging and failure modes

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.

Practice

Tune a proportional-only lift or arm controller on blocks. Graph target, position, error, and output if Dashboard is available.

Checks

  • The mechanism moves toward the target.
  • Output decreases as error gets smaller.
  • The robot has a safe way to disable the controller.

Check your understanding

Module check

What is PID error?

0 of 1 answered

References

Game Manual 0Community FTC programming, control, and robot design reference.FTC DashboardTelemetry, config variables, and tuning support.

Finished reading?

Mark this lesson complete.

You'll move on to “Feedforward and PIDF” next.

Actions and SequencingFeedforward and PIDF