WestlakeLEARN
FTC · Java

FIRST Tech Challenge

FTC · Java

  • Simple Autonomous
  • Encoder Autonomous
  • Autonomous State Machines
  • Actions and Sequencing
  • Build a Vision-Selected Autonomous

Simple Autonomous

Build an autonomous routine with timers and safe stops.

Module 8: Autonomous FoundationsAutonomous

In this lesson, you will:

  1. 01Sequence actions without blocking forever.
  2. 02Use timeouts on every movement.
  3. 03End autonomous in a known safe state.

Autonomous is a sequence of small promises

Each step should have one job: drive, turn, wait, move an arm, or stop. Small steps are easier to test and easier to fix at events.

Every step needs an exit

A robot should never wait forever for a sensor or encoder. Even basic autonomous code should include timeouts and a final stop.

Show the current step on telemetry

When autonomous misbehaves at an event, the first question is always: which step was it on? Printing the current step name means you can answer from the Driver Station screen instead of guessing from robot behavior.

Robot code habit

Give every step a short telemetry name so an interrupted run tells you where it stopped.

On-robot safety

Every moving step needs an active-state check, a timeout, and an explicit zero-power command afterward.

TimedAuto.javaJava

waitForStart();
if (isStopRequested()) return;

runtime.reset();

while (opModeIsActive() && runtime.seconds() < 1.0) {
  setDrivePower(0.25, 0.25);
  telemetry.addLine("Step: drive forward");
  telemetry.update();
}

setDrivePower(0, 0);
if (!opModeIsActive()) return;
sleep(300);

runtime.reset();
while (opModeIsActive() && runtime.seconds() < 0.5) {
  setDrivePower(0.2, -0.2);
  telemetry.addLine("Step: turn");
  telemetry.update();
}

setDrivePower(0, 0);
telemetry.addLine("Step: complete");
telemetry.update();

Practice

Build a three-step routine: drive forward for one second, stop and wait, then turn slowly for half a second. Press STOP during each moving step to verify that the drivetrain returns to zero.

Checks

  • Every moving step has both an active-state check and a timeout.
  • Pressing STOP during either movement returns drivetrain power to zero.
  • The routine sends a final zero command after the last step.
  • Telemetry shows the current autonomous step.

Lesson check

Check your understanding before moving on.

Why does every autonomous movement need a timeout?

What should the last action of an autonomous routine be?

0 of 2 answered

References

FTC DocsOfficial FTC SDK and robot programming documentation.Road Runner 1.0 DocsCurrent official setup guide. Confirm TeamCode's Gradle versions first; 1.0 is not compatible with 0.5.x examples.Road Runner 1.0 ActionsCurrent autonomous composition model. Verify the robot project uses Road Runner 1.0 before following these examples.

Finished reading?

Mark this lesson complete — “Encoder Autonomous” is up next.

Interfaces, Packages, and Code OrganizationEncoder Autonomous