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.
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.
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.
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.
Create three device test OpModes: motor, servo, and distance sensor. Record safe ranges and expected readings.
Check your understanding before moving on.
0 of 2 answered