WestlakeLEARN
FTC · Java

FIRST Tech Challenge

FTC · Java

  • Build a Reusable RobotHardware Template
  • Motors, Servos, and Sensor Sanity Tests

Motors, Servos, and Sensor Sanity Tests

Device-specific tests before full robot code.

Module 3: Hardware EssentialsCore

In this lesson, you will:

  1. 01Test one actuator at a time.
  2. 02Respect servo ranges and motor modes.
  3. 03Read sensor values before using thresholds.

Concept narrative

Motors create continuous motion, servos seek positions, and sensors produce measurements. Treating them as interchangeable is how teams break mechanisms or write logic from unverified assumptions.

This lesson should be read as a robotics lesson first and a programming lesson second. The code matters because it lets the team create repeatable behavior under match pressure. Students should slow down long enough to name the inputs, outputs, assumptions, and safety limits before they touch the robot.

Robot mental model

A device test is a microscope. It removes the rest of the robot so the team can see whether the device, wiring, configuration, and code agree.

A good mental model gives the team a shared language. When a driver, builder, and programmer can point to the same behavior and use the same words, debugging gets calmer and code review becomes useful instead of personal.

Implementation walkthrough

Write a motor direction test, a servo sweep with safe endpoints, and a sensor telemetry test. Each test should be short enough to run at an event without risking the whole robot.

Keep the implementation staged. First create the smallest version that compiles. Then add telemetry that proves it is running. Then connect one hardware device or one decision. Finally, repeat the test from a cold init so the team knows it was not a lucky hot reload.

DeviceTests.javaJava

double cm = distance.getDistance(DistanceUnit.CM);
boolean close = cm < 8.0;
telemetry.addData("distance cm", cm);
telemetry.addData("close", close);
servo.setPosition(gamepad1.a ? 0.35 : 0.10);

Common mistakes and debugging

A servo that hums may be mechanically bound. A motor that moves backward may need direction setup. A sensor threshold that works in the shop may fail under field lighting. Isolate before integrating.

Use the five-value debugging habit: input, state, target, measurement, output. If one of those values is missing, add it before rewriting logic. The goal is to make the robot tell the truth about what it thinks is happening.

Practice

Create three device test OpModes: motor, servo, and distance sensor. Record safe ranges and expected readings.

Checkpoint

  • Each device has a safe test.
  • Telemetry shows raw readings.
  • Thresholds are justified by observations.

Reflection check

Check your understanding before moving on.

What is the most important habit in Motors, Servos, and Sensor Sanity Tests?

0 of 1 answered

References

FIRST FTC DocsOfficial SDK, Robot Controller, and programming reference.Learn Java for FTCFTC-focused Java book and exercises by Alan G. Smith.Game Manual 0FTC community reference for programming, controls, and robot design.

Finished reading?

Mark this lesson complete — “IMU, Encoders, and Bulk Caching” is up next.

Build a Reusable RobotHardware TemplateIMU, Encoders, and Bulk Caching