Motors, Servos, and Sensor Sanity Tests
Device-specific tests before full robot code.
Device-specific tests before full robot code.
In this lesson, you will:
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.
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.
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);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.
Check your understanding before moving on.
What is the most important habit in Motors, Servos, and Sensor Sanity Tests?
0 of 1 answered
Mark this lesson complete — “IMU, Encoders, and Bulk Caching” is up next.