Skip to content
Work in progress. This library and its docs are new and still changing, and some parts are not yet tested on a real robot. Something wrong or unclear?Tell us (a GitHub issue).

Tutorial 19: Testing procedures

You will build: a 3-line OpMode that lets you test every motor, servo and sensor on the robot by hand. This is also lesson 2b of the main track (after lesson 2, Drive).

You will learn: how to use the Hardware Check OpMode, a fixed order for testing a robot (laptop, bench, floor, autonomous, event), and how to turn a problem into a fix that stays fixed.

You need: any robot. Tutorials 01-03.

Full program: Tut19HardwareCheck.java (yes, it is 3 lines) Reference: testing.md. Guide with all checklists: Testing procedures.


The OpMode itself is 3 lines. With the lines every Java file needs, the whole file is this. Make a new Java file HardwareCheck.java in your teamcode folder (how to make a file), and replace everything in it with:

package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.crossbotics.ftchelper.testing.HardwareCheckOpMode;
@TeleOp(name = "Hardware Check", group = "Tests")
public class HardwareCheck extends HardwareCheckOpMode {
}
  • File name: HardwareCheck.java, the same as the class name after public class.
  • The package line says the file is in the teamcode folder.
  • The two import lines say where TeleOp (from the FTC SDK) and HardwareCheckOpMode (from this library) are. Why: without them, the build says cannot find symbol.
  • No @Disabled line: the Driver Station lists it.

extends means “is a kind of”: this OpMode is a HardwareCheckOpMode, so it does everything that class does. The library wrote the OpMode; you only give it a name. (The tutorial’s own copy is named “Tutorial 19: Hardware Check”; the name in @TeleOp(name = ...) can be anything.)

Put the robot on a block, so the wheels are off the ground. Run it. It lists every device in the active configuration and the battery voltage.

  • D-pad up/down: choose a device. Changing device stops the last motor.
  • Motor: right stick = power (50% max; hold RB for 100%). Watch: does positive power turn it the way you expect? Does the encoder count UP? A = zero the encoder.
  • Servo: D-pad right/left = +/- 0.01, bumpers +/- 0.1, X = 0.5. Write down the positions you need.
  • Sensors: live values. Press the switch, wave a hand at the distance sensor.
  • IMU: turn the robot left by hand: yaw goes UP (if your hub is mounted logo up, USB forward).
flowchart LR
    A["laptop tests"] --> B["Hardware Check<br/>(on a block)"] --> C["mechanism checks"] --> D["floor, low power"] --> E["autonomous runs<br/>read the report"]

Do the steps in this order. Each step catches problems the next one would make dangerous or confusing. Example: a reversed drive motor (found in seconds at step B) looks like “the robot spins randomly” at step D.

The full checklists, including the 2-minute pre-match check, are in Testing procedures. Print them for the pit.

  1. Write it down: what you did, what you expected, what happened. Turn debug telemetry on and take a photo of the screen.
  2. Reproduce it on the bench. A problem you cannot repeat cannot be fixed on purpose.
  3. Find the layer (where the problem lives): hardware (Hardware Check shows it)? configuration (names)? your code? the library?
  4. Fix it and add a test if it was logic (tutorial 13), so it can never come back silently.
  5. Note it in the team’s log: the next driver or programmer will meet it again.
  1. Make the file from section 1 in TeamCode (the whole file, with its package and import lines), build, install and run it.
  2. Go through every device once. Fix any direction or name problem you find.
  3. Take the pre-match checklist from the guide and time yourself: it should take about 2 minutes.
  1. Make your own OpMode that runs every drive motor forward for 1 second in turn, and shows its encoder change.
  2. Write a test (tutorial 13) for something that once went wrong on your robot.

On the main track, next: Lesson 3: Buttons. Under the hood: Tutorial 20: Easy TeleOp, 21: Find your numbers, and Lesson 1: The robot in five files, the shortest way to a whole robot program. Extending the library when you build something new.