01 / Java for FTC
OpMode Anatomy and Hello Robot
Understand packages, imports, classes, annotations, and the code the Driver Station runs.
01 / Java for FTC
Understand packages, imports, classes, annotations, and the code the Driver Station runs.
You will
This lesson is part of the Java foundation, so the emphasis should be on how a small language feature becomes a robot habit. Students should leave understanding the syntax, but more importantly they should understand what the robot will do differently because that syntax exists. Keep the focus on readable values, predictable flow, and code that another teammate can safely modify later.
An FTC OpMode is a Java class the SDK can discover and show on the Driver Station. The class name, file name, package, imports, annotation, and overridden method all work together; if one piece is wrong, the code may compile but never appear where drivers expect it.
Before controlling motors, students should learn to print useful values. Telemetry gives immediate feedback during init and while the OpMode is active, which makes every later debugging task easier.
Have students make one small edit, run it, observe telemetry, and explain the result before moving on. This is slower than pasting a large example, but it builds the debugging discipline they will need once hardware is involved.
For this specific lesson, students should first restate the goal in robot terms, then identify the value or behavior they expect to observe, then run the smallest test that proves the idea. The lesson should feel like a guided lab: predict, run, observe, explain, and only then extend.
HelloRobot.java · Java
@TeleOp(name = "Hello Robot")
public class HelloRobot extends LinearOpMode {
@Override
public void runOpMode() {
telemetry.addLine("Initialized");
telemetry.update();
waitForStart();
while (opModeIsActive()) {
telemetry.addData("Runtime", getRuntime());
telemetry.addData("Left stick y", gamepad1.left_stick_y);
telemetry.update();
}
}
}Most failures at this level come from hidden assumptions: a value has the wrong sign, a method runs at the wrong time, a variable is scoped where later code cannot see it, or a class is named differently than its file. The lesson should train students to check the smallest claim first instead of rewriting the whole OpMode.
Check your understanding
What makes an FTC OpMode show up on the Driver Station?
0 of 1 answered
References
Finished reading?
You'll move on to “Variables, Math, and Decisions” next.