02 / FTC Hardware Essentials
Motors, Servos, and Sensors
Control common FTC devices safely and read useful sensor values.
02 / FTC Hardware Essentials
Control common FTC devices safely and read useful sensor values.
You will
This lesson connects Java objects to real devices on the robot. The core idea is that configuration names, ports, directions, modes, and safe ranges are part of the code contract. If that contract is sloppy, every later TeleOp, autonomous, and control lesson becomes harder to trust.
A mechanism OpMode that only moves one motor or servo is not wasted time. It proves the configuration, direction, range, and safety limits before the mechanism enters match code.
Distance and color sensors should be printed to telemetry first. Once students trust the readings, those values can drive decisions such as stopping before a wall or detecting a game element.
Build from one device outward. Prove a motor, then a drivetrain, then a sensor, then a reusable hardware class. Each addition should have a test OpMode or telemetry checkpoint so students can identify whether the problem is code, configuration, wiring, or mechanism design.
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.
SensorStop.java · Java
DistanceSensor distance = hardwareMap.get(DistanceSensor.class, "front_distance");
while (opModeIsActive()) {
double cm = distance.getDistance(DistanceUnit.CM);
boolean tooClose = cm < 5.0;
robot.frontLeft.setPower(tooClose ? -0.15 : 0.20);
robot.frontRight.setPower(tooClose ? -0.15 : 0.20);
telemetry.addData("Distance cm", cm);
telemetry.addData("Too close", tooClose);
telemetry.update();
}Hardware bugs often masquerade as programming bugs. A wrong config name looks like bad Java, a reversed motor looks like bad math, and a noisy sensor looks like bad logic. Students should learn to isolate the physical device before changing higher-level robot behavior.
Check your understanding
What should you do before using a sensor value to control motion?
0 of 1 answered
References
Finished reading?
You'll move on to “IMU, Encoders, and Bulk Caching” next.