Skip to content
Week 5 · Lesson 1 35 min

What Autonomous Is and How It Runs

Learn what happens in the 30-second Autonomous period, which sensors help a robot find its way, and how an autonomous OpMode moves from INIT to STOP.

In this lesson you will

  • Describe the Autonomous period and where it sits in a match
  • Explain why a simple, reliable routine beats an ambitious, unreliable one
  • Identify common sensors used in autonomous and what each one measures
  • Write a minimal @Autonomous OpMode that follows the INIT, start, run and stop lifecycle

Lesson

Every FIRST Tech Challenge match begins with the Autonomous period: 30 seconds in which robots move only on code that the team wrote before the match. Nobody touches the gamepads. After a short transition (8 seconds), the 2-minute Driver-Controlled (TeleOp) period starts, and its final part is usually called the endgame.

AutonomousDriver-ControlledEndgameTransition0:000:300:382:082:38General format — check the current manual
A match: 30 seconds of Autonomous, a short transition, then Driver-Controlled with the endgame at the end.

Why autonomous matters

  • In many seasons, tasks completed during Autonomous are worth extra points compared with doing the same task later.
  • A good autonomous routine can leave your robot in a useful position for the start of Driver-Controlled.
  • Autonomous is the clearest test of your engineering: the robot has to sense, decide and move with no human help.
  • Your alliance partner depends on you. Two robots with predictable paths are far less likely to collide.

Here is the most important idea of this week: reliability beats ambition. A short routine that works every single time is worth more than a long one that works only sometimes. Start small, such as driving off the start line and parking, and add steps only when the earlier steps are dependable. Talk to your alliance partner before each match about where both robots will go; that is Gracious Professionalism and Coopertition in action.

How a robot knows where it is

During Autonomous there is no driver watching, so the robot needs sensors to measure what it is doing. These are the most common ones on FTC robots:

SensorWhat it measuresTypical autonomous use
Motor encoderHow far the motor shaft has rotated (in ticks)Driving a set distance, moving an arm to a position
IMU (inside the Control Hub)How much the robot has rotatedTurning to an exact heading, driving straight
Distance sensorDistance to a nearby object or wallStopping a set distance from a wall
Color sensorColor and brightness of a surfaceDetecting tape lines or a game element's color
Touch sensor / limit switchWhether something is pressedKnowing a lift has reached the bottom
WebcamImages for vision processingFinding game elements or field markers

This week focuses on encoders and the IMU, because almost every robot already has them and together they are enough for a solid basic routine.

The life of an autonomous OpMode

InithardwareMap.get(...)waitForStart()Loopwhile (opModeIsActive())① read inputs② set outputs③ telemetryStop
An OpMode runs INIT, waits for START, runs its main code, then stops.
  1. 1
    INIT
    The driver selects your OpMode and presses INIT. Your code maps hardware, sets motor directions, resets encoders and prepares the IMU. The robot must not move yet.
  2. 2
    Wait for start
    waitForStart() pauses your code until the driver presses START when the match begins.
  3. 3
    Run
    Your code performs its moves one after another. Every loop should check opModeIsActive() so the robot stops when asked.
  4. 4
    Stop
    The OpMode ends when your code finishes, when the driver presses STOP, or when the Autonomous timer runs out. Always set motor power to 0 at the end.
JAVA
1package org.firstinspires.ftc.teamcode;
2
3import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
4import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
5import com.qualcomm.robotcore.hardware.DcMotor;
6import com.qualcomm.robotcore.util.ElapsedTime;
7
8@Autonomous(name = "Timed Drive Test", group = "Auto")
9public class TimedDriveTest extends LinearOpMode {
10    @Override
11    public void runOpMode() {
12        // INIT: runs after the driver presses INIT
13        DcMotor leftDrive = hardwareMap.get(DcMotor.class, "left_drive");
14        DcMotor rightDrive = hardwareMap.get(DcMotor.class, "right_drive");
15        leftDrive.setDirection(DcMotor.Direction.REVERSE);
16        ElapsedTime timer = new ElapsedTime();
17
18        telemetry.addData("Status", "Initialized, waiting for START");
19        telemetry.update();
20        waitForStart();
21
22        // RUN: drive forward for 1.5 seconds
23        timer.reset();
24        leftDrive.setPower(0.4);
25        rightDrive.setPower(0.4);
26        while (opModeIsActive() && timer.seconds() < 1.5) {
27            telemetry.addData("Time", "%.2f s", timer.seconds());
28            telemetry.update();
29        }
30
31        // STOP: always cut power at the end
32        leftDrive.setPower(0);
33        rightDrive.setPower(0);
34    }
35}
A minimal autonomous that drives forward for 1.5 seconds using a timer.

Key terms

Autonomous period
The first 30 seconds of a match, when robots run only on pre-written code with no driver input.
OpMode
A program that runs on the robot and is selected from the Driver Station, either TeleOp or Autonomous.
`@Autonomous`
An annotation that makes an OpMode appear in the Driver Station's autonomous list.
`ElapsedTime`
An FTC SDK timer class that measures how many seconds have passed since it was created or reset.
Sensor
A device that measures something about the robot or its surroundings so the code can react to it.

Practical exercise

Run your first autonomous and see why timers are unreliable

  1. 1Create the TimedDriveTest OpMode and make sure the motor names match your robot configuration exactly.
  2. 2Mark a start line on the floor with painter's tape and line up the back of the robot with it.
  3. 3Run the OpMode 5 times with the same battery and measure how far the robot travelled each time.
  4. 4Swap to a different (more or less charged) battery and run it 5 more times.
  5. 5Compare the two sets of distances and write down what changed and why you think it changed.
Deliverable: A table of 10 measured distances (5 per battery) with a two-sentence conclusion about timed driving.

Knowledge check

Answer every question, then check your answers.

  1. Q1How long is the Autonomous period at the start of an FTC match?
  2. Q2What does waitForStart() do in a LinearOpMode?
  3. Q3Which sensor is the best choice for turning the robot to an exact heading?
  4. Q4Why is driving for a fixed time unreliable?

Further resources

Mark lesson complete