Skip to content

Stage 1A Overview

Welcome to Stage 1A! Before we can start programming, we have to fork and clone the relevant repository:

  • If your team primarily uses REV electronics (such as Spark MAX motor controllers), clone the REV template.
  • If your team primarily uses CTRE electronics (such as Kraken motors), clone the CTRE template.
Tip

If you forgot how to fork and clone a repository, read over the Forking and Cloning guide.

Now, before we get into the depths of the robot code, it’s useful to look at a high-level overview of the contents of a typical WPILib project. As your code gets more advanced, you’ll see more folders and files appear, but they’re all controlled by the same basic components.

  • Directorysrc
    • Directorymain
      • Directoryjava
        • Directoryfirst
          • Directoryrobot
            • Directoryopmode
              • MyAuto.java
              • MyTeleop.java
            • Directorysimulation
              • DrivetrainSim.java
              • SingleFlywheelSim.java
            • Robot.java
          • Main.java

You’ll notice that we’re skipping a lot of files here, because you don’t have to edit those. What’s great about using a framework like WPILib is that it automatically generates these files when you create a new project, so you can get started coding quicker. The other folders, like src/main/deploy/ for example, will come in handy as your robot code becomes more advanced. Thus, the only files shown in the structure tree are the ones directly responsible for controlling what our kitbot will do.

Note

For those who have programmed in FRC before, WPILib is currently undergoing a massive rewrite for the 2027 version, especially with regards to OpModes and Commands V3, so some files and components may be completely new!

The first file to take note of is the Main.java file; this is the entrypoint for any Java project in real life. Its contents are pretty short and sweet (comments and package declaration removed for brevity):

import org.wpilib.framework.RobotBase;
public final class Main {
private Main() {}
public static void main(String... args) {
RobotBase.startRobot(first.robot.Robot::new);
}
}

You can see that all the Main.java file is doing is, quite literally, starting up the robot, so there’s no reason to edit this file.

Note

Notice that the names of all Java files in the project follow PascalCase, where the first letter of every word is capitalized. This is a convention you should follow throughout your code.

But what is that one line in Main.java doing?

RobotBase.startRobot(first.robot.Robot::new);

It seems to be “starting” an instance of the first.robot.Robot class, and if we go to that class file, we end up at Robot.java. This is the core of your robot code, where:

  • your subsystems are defined
  • shared behavior is defined
  • your debugging data is logged (telemetry).
Note

For prior FRC programmers, you might have noticed a RobotContainer.java file is missing. This file is not used with the Commands v3 framework.

We’ll go through this file, as well as all of the functionalities, more in detail later.

This folder contains all the OpModes that your robot will run. An OpMode is a class that controls the behavior of your robot during a specific robot mode (autonomous, teleop, and utility). You can have multiple OpModes per robot mode, and they are selected on the Driver Station to tell the robot which one to run. This allows you to have different autonomous routines for different situations, or multiple teleop routines for different drivers. OpModes use the Robot class to access the robot’s subsystems and other shared behavior.

Note

Prior FRC programmers may have used SendableChooser to register different autonomous routines. OpModes replace SendableChooser, as they are integrated into the Driver Station and registered automatically.

These are the files that control simulation of the robot, allowing you to test code without actually having a physical robot in front of you. We’ve set this up for you already; you’ll just have to set up the simulation software yourself, which we’ll cover at the end of Stage 1A.

But what is all this code actually going to control? Well, the answer is the 2026 FIRST Robotics Competition kitbot, the best starting point for new FRC teams, as well as the simplest robot to get fully working. You can watch the below video to learn more about what functionalities the kitbot has. If you’re a bit confused after watching that video, don’t worry. We’ll explain the kitbot more in depth in the next section.

And that’s all you need to know to get started! The rest of Stage 1A will cover how to get from the template code to a working kitbot.

This stage will cover the following topics: