Don't Blink LogoFTC Stack

OpModes

Learn how FTC programs are structured.

An OpMode is a program that runs on your robot. Every TeleOp, Autonomous, and testing program you create is an OpMode.

OpModes allow your code to communicate with the FTC Robot Controller and control your hardware.

Creating an OpMode

OpModes are created as Java classes that extend either:

  • LinearOpMode
  • OpMode

Example:

@TeleOp
public class ExampleTeleOp extends LinearOpMode {

    @Override
    public void runOpMode() {

    }
}

The annotation tells the FTC SDK what type of program this is.

TeleOp vs Autonomous

TeleOp

TeleOp programs are controlled by drivers using gamepads.

@TeleOp(name = "Drive TeleOp")
public class DriveTeleOp extends LinearOpMode {

}

Examples:

  • Driving the robot
  • Controlling mechanisms
  • Operating the intake or shooter

Autonomous

Autonomous programs run without driver input.

@Autonomous(name = "Auto")
public class Auto extends LinearOpMode {

}

Examples:

  • Following paths
  • Scoring game elements
  • Moving to specific locations

LinearOpMode

LinearOpMode uses a sequential programming style.

The robot executes code from top to bottom.

@Override
public void runOpMode() {

    waitForStart();

    while (opModeIsActive()) {

    }
}

runOpMode()

This is where your robot code goes.

public void runOpMode() {

}

waitForStart()

Pauses your program until the driver presses start.

waitForStart();

opModeIsActive()

Checks whether the OpMode is currently running.

while (opModeIsActive()) {

}

OpMode

OpMode uses an event-loop style.

Instead of one long program, the SDK repeatedly calls your methods.

@TeleOp
public class Example extends OpMode {

    @Override
    public void init() {

    }

    @Override
    public void loop() {

    }
}

init()

Runs once when the OpMode starts.

Used for:

  • Hardware initialization
  • Setting variables
  • Preparing the robot

loop()

Runs repeatedly while the OpMode is active.

Used for:

  • Reading gamepads
  • Controlling motors
  • Updating mechanisms

LinearOpMode vs OpMode

LinearOpModeOpMode
Sequential codeEvent-based code
Uses runOpMode()Uses init() and loop()
Easier for beginnersMore advanced
Common for autonomousCommon for TeleOp frameworks

Most beginners should start with LinearOpMode.

Utility OpModes (Coming Soon!)

Introduced in SDK version 11.2, Utility OpModes are programs used for testing and debugging.

Running an OpMode

To run your program:

  1. Build the project in Android Studio.
  2. Upload the code to the Control Hub.
  3. Open the Driver Station app.
  4. Select your OpMode.
  5. Press Start.

Key Takeaways

  • An OpMode is a robot program.
  • TeleOp uses driver input.
  • Autonomous runs without drivers.
  • LinearOpMode uses sequential programming.
  • OpMode uses an event loop.
  • Utility OpModes help test and debug robots.

Was this resource helpful?

On this page

Was this resource helpful?