WestlakeLEARN
FTC · Java

FIRST Tech Challenge

FTC · Java

  • What an OpMode Does
  • Variables, Types, and Units
  • If Statements and Loop Flow
  • Methods, Classes, and Helpers
  • Enums, Lists, and Team Vocabulary

What an OpMode Does

Understand the program the Robot Controller runs after it is selected on the Driver Station.

Module 1: Java Foundations for FTCStart here

In this lesson, you will:

  1. 01Explain init, start, loop, and stop in plain language.
  2. 02Read a LinearOpMode without getting lost.
  3. 03Use telemetry to prove code is running.

The robot only runs selected OpModes

An OpMode is a program that appears on the Driver Station. In FTC, programmers usually write either a TeleOp OpMode for driver control or an Autonomous OpMode for pre-planned actions.

LinearOpMode is easiest for new programmers

LinearOpMode runs like a normal script: initialize hardware, wait for start, then repeat while the match is active.

Code before waitForStart runs during init

Everything above waitForStart() runs when the driver presses INIT, before the match begins. That is the place for hardware setup and a ready message. The code inside while (opModeIsActive()) is your real-time loop — keep it fast and free of long sleeps.

Robot code habit

Use distinct INIT and running telemetry messages so you can tell exactly where execution has reached.

On-robot safety

Keep the active loop fast. Long sleeps make controls and STOP requests feel unresponsive.

HelloTeleOp.javaJava

@TeleOp(name = "Hello TeleOp")
public class HelloTeleOp extends LinearOpMode {
  @Override
  public void runOpMode() {
    telemetry.addLine("Ready for Westlake Robotics");
    telemetry.update();

    waitForStart();

    while (opModeIsActive()) {
      telemetry.addData("Runtime", getRuntime());
      telemetry.addData("Left stick Y", gamepad1.left_stick_y);
      telemetry.update();
    }
  }
}

Practice

Create a TeleOp that prints a ready message during INIT, then shows runtime and one gamepad value after START. Press STOP and confirm that the values stop updating.

Checks

  • The OpMode appears in the correct Driver Station list.
  • The ready message appears after INIT but before START.
  • Runtime and gamepad telemetry update only while the OpMode is active.
  • Telemetry stops changing after STOP is pressed.

Lesson check

Check your understanding before moving on.

What does waitForStart() actually do?

Why does the loop check opModeIsActive()?

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.Creating and Running an Op ModeOfficial OnBot Java OpMode walkthrough.

Finished reading?

Mark this lesson complete — “Variables, Types, and Units” is up next.

Variables, Types, and Units