Skip to lesson
Westlake RoboticsLearn
Vault

FIRST Tech Challenge

Loading progress…

  • Voltage, Current Awareness, and Safe Test OpModes

Voltage, Current Awareness, and Safe Test OpModes

Avoid damaging robot hardware while testing code.

Safe TestingCore

In this lesson, you will:

  • Read voltage as context.
  • Design low-power tests.
  • Create disable and stop paths.

Concept narrative

Battery voltage changes robot behavior. A drivetrain that feels gentle at low voltage may be aggressive on a fresh battery, and a mechanism near a hard stop can draw damaging current.

Robot mental model

Safe test code assumes something might be wrong. It uses low power, short timeouts, telemetry, and an easy stop path so students can learn without turning every bug into a repair job.

Implementation walkthrough

Add voltage telemetry to tests, start with low motor power, clamp outputs, and use timeouts. For mechanisms, begin away from hard stops and verify direction before full travel.

SafeMotorTest.javaJava

double voltage = hardwareMap.voltageSensor.iterator().next().getVoltage();
runtime.reset();
while (opModeIsActive() && runtime.seconds() < 1.0) {
    motor.setPower(0.2);
    telemetry.addData("voltage", voltage);
    telemetry.update();
}
motor.setPower(0);

Common mistakes and debugging

If a motor stalls, stop and inspect the mechanism before increasing power. If voltage is low, do not tune final constants. If a test has no timeout, add one before running it on the floor.

Practice

Write a motor test that runs at 20 percent power for one second, reports voltage, then stops regardless of sensor state.

Checkpoint

  • Power starts low.
  • Voltage is recorded.
  • The test stops on timeout and Stop.
  • The test record includes the setup, prediction, and observed result.
  • A teammate can repeat the check from the saved evidence without guessing.

Reflection check

Check your understanding before moving on.

Why record battery voltage during a repeatable low-power motor test?
What should happen immediately after a timed safe-test loop exits for any reason?

0 of 2 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.
Loading lesson progress
Previous lessonCompetition Code Freeze and Recovery WorkflowNext lessonCapstone: Reusable RobotHardware Template