Skip to lesson
Westlake RoboticsLearn
Vault

FIRST Tech Challenge

Loading progress…

  • Git Workflow for FTC Teams
  • Debugging with Telemetry
  • IMU, Encoders, and Bulk Caching
  • Code Review for Robot Programmers
  • Competition Code Freeze and Recovery Workflow

Debugging with Telemetry

Use telemetry to find what the robot thinks is true.

Team Workflow and Competition ReadinessWalkthrough

In this lesson, you will:

  • Print sensor and state values clearly.
  • Classify a fault as input, calculation, command, or hardware.
  • Run a one-change debugging experiment and record the evidence.

Telemetry is the robot talking back

Good telemetry turns mystery behavior into visible data. Show joystick input, current state, motor power, and any sensor value that affects decisions.

Debug the smallest claim first

Before rewriting logic, check whether the robot sees the same input you think it sees. Most fixes start with one boring value on screen.

Change one thing at a time

If you change three things and the robot improves, you do not know which change worked or which one will bite you later. Make one change, test it, write down what happened, then move on.

Use an evidence ladder

Trace one value through four layers: driver or sensor input, calculated value, commanded output, and physical response. The first layer that disagrees with your prediction is where the investigation should focus.

Robot code habit

Display expected and actual values together when debugging a sensor or mechanism target.

On-robot safety

Do not raise motor power to diagnose an unknown fault. Prove the input and calculation first, then test hardware at low power.

Your browser does not support embedded video. Use the open-video link below.
0:00 / 0:00
Find the first mismatch with telemetryOpen video Download captions
Video transcriptRead or search the narration

So, you already know that telemetry lets us see values from inside the robot loop. Let's use it to find the first layer that disagrees with what we think should happen instead of changing random parts of the actual code. So, we want to start with a prediction. So, in this fixture, the drive is positive 0.5, strafe is zero, and turn is zero. That should produce positive 0.5 for all four of our wheel commands. The input, calculation, and command layers are all software. After that, the evidence crosses into the actual robot configuration, the hub ports, wiring, and the actual mechanism. This example stops at that boundary. We do not have physical robot evidence to inspect. So, looking at the code here, this is the clean fixture. The three inputs are fixed, so every replay uses the same conditions. Directly below them, the four mixer equations calculate front left, front right, back left, and back right. And telemetry prints the inputs and all four results together. The clean front-right line is drive minus strafe minus turn. With our inputs, that is 0.5 minus zero minus zero: positive 0.5. Now, if we compare that with a controlled faulty version, only the front-right equation has changed. So, if we have a negative sign that appears in front of drive, like so, every other input and equation remains exactly the same. So, the input still matches our prediction. Front left, back left, and back right also match. Front right is the first disagreement. We expected positive 0.5 and observed negative 0.5. That tells us where to look. We have evidence for an arithmetic problem in the front-right mixer equation. We do not have a reason to rename a configured motor, reverse a motor direction, or inspect a wire. So, when the original front-right equation is restored and the same inputs are replayed, all four values return to positive 0.5. The evidence record should include the prediction, the incorrect value, the exact one-line change, and the corrected value. Then we use the same method on the season robot. If the software values agree but the wrong wheel moves, move down one layer to the configuration and port map. If the correct wheel moves in the wrong direction, inspect the declared direction. The useful habit is to stop at the first mismatch instead of guessing across every layer at once. Now, I know this sort of concept and example seems really, really simple, but the sort of intent behind it is really important. Instead of looking and guessing at what you think might be the problem deeper down, start at the first mismatch, and then that'll actually save you time in the future. So, again, this is super simple, but try and apply it to the problems we actually encounter every day when you program.

TelemetryDebug.javaJava

telemetry.addData("Drive", drive);
telemetry.addData("Strafe", strafe);
telemetry.addData("Turn", turn);
telemetry.addData("Lift target", liftTargetTicks);
telemetry.addData("Lift position", liftMotor.getCurrentPosition());
telemetry.update();

Practice

Add telemetry for drivetrain inputs, calculated wheel powers, commanded outputs, and one mechanism state. Have a teammate introduce one safe fault, such as a wrong configuration name in a disabled test copy or an incorrect sign in the calculation. Predict each layer, locate the first mismatch, make one correction, and record the before-and-after evidence.

Checks

  • Every label is short enough to scan from the Driver Station under pressure.
  • Each displayed input changes only when its matching control changes.
  • Calculated motor powers agree with the command before the wheels are allowed to move.
  • A teammate can use the display to name whether a fault is in the input, math, or hardware layer.
  • The debug note records one hypothesis, one change, and the observed result.

Lesson check

Check your understanding before moving on.

The robot drifts left when the driver pushes straight forward. What do you check first?
What makes a telemetry label useful during a match?

0 of 2 answered

References

FTC DocsOfficial FTC SDK and robot programming documentation.Road Runner 1.0 DocsCurrent official setup guide. Confirm TeamCode's Gradle versions first; 1.0 is not compatible with 0.5.x examples.
Loading lesson progress
Previous lessonGit Workflow for FTC TeamsNext lessonIMU, Encoders, and Bulk Caching