Software Programming Guide

Follow these steps to set up your FRC robot programming environment

Step 1

SPARK MAX Firmware Update

Before programming your robot, you need to ensure all SPARK MAX motor controllers have the latest firmware.

Why Update Firmware?

  • Bug fixes and performance improvements
  • Compatibility with latest WPILib versions
  • New features and optimizations

Installation Steps:

  1. Download REV Hardware Client

    Visit the REV Robotics website and download the latest version of REV Hardware Client for Windows.

    REV Hardware Client Download
  2. Connect SPARK MAX via USB-C

    Connect your SPARK MAX to your computer using a USB-C cable. The device should appear in REV Hardware Client.

  3. Update Firmware

    In REV Hardware Client, select your SPARK MAX and click 'Update Firmware'. For 2025, use firmware version 25.0.1 or later.

  4. Factory Reset & Persist Parameters

    After updating to firmware 25.x for the first time, perform a Factory Reset, then click 'Persist Parameters'.

⚠️ Important Note

If you have SPARK MAXes on firmware 25.0.0, update them individually to 25.0.1 with robot power OFF to avoid CAN bus issues.

Step 2

CAN Device ID Configuration

Each device on the CAN bus must have a unique ID. By default, SPARK MAX controllers come with ID 0, which must be changed.

Setting Device IDs:

  1. Open REV Hardware Client

    Connect your SPARK MAX via USB-C as in Step 1.

  2. Change CAN ID

    In the 'Basic' tab, find the 'CAN ID' field. Set it to a unique number between 1-62. Common practice is to use sequential IDs (1, 2, 3...) for each motor controller.

  3. Label Your Devices

    Use a label maker or tape to physically mark each SPARK MAX with its assigned CAN ID. This makes troubleshooting much easier!

  4. Document Your IDs

    Create a spreadsheet or document listing which motor (left drive, right drive, intake, etc.) uses which CAN ID.

💡 Pro Tip

Organize your CAN IDs logically: 1-10 for drivetrain, 11-20 for manipulators, etc. This makes code more readable and maintenance easier.

Step 3

WPILib Installation

WPILib is the official software library for FRC. It includes everything you need to program your robot: VS Code, Java/C++ development tools, and robot utilities.

System Requirements:

  • Windows 10 or 11 (64-bit)
  • macOS 12 or later
  • Ubuntu 22.04 or 24.04 (64-bit)
  • At least 4GB RAM (8GB recommended)

Installation Steps:

  1. Download WPILib

    Go to the official WPILib releases page and download the latest installer for your operating system (WPILib 2025.3.2 or newer).

    WPILib Downloads
  2. Run the Installer

    Extract and run the installer. Choose 'Install for this User' and select a location (default is recommended).

  3. Download VS Code Extensions

    The installer will download WPILib VS Code (separate from any existing VS Code installation) and all necessary extensions.

  4. Launch WPILib VS Code

    After installation, launch 'WPILib VS Code 2025' (not regular VS Code). You should see the WPILib icon in the top right corner.

What Gets Installed?

  • Visual Studio Code with FRC extensions
  • Java JDK for robot development
  • WPILib libraries and tools
  • Simulation tools (Glass, SmartDashboard, Shuffleboard)
  • PathWeaver for autonomous path planning
Step 4

FRC Game Tools (Windows Only)

FRC Game Tools include the Driver Station and imaging tools needed to operate your robot. This is only required on Windows machines used to drive the robot.

Installation Steps:

  1. Download from National Instruments

    Visit the FIRST website to get the download link for FRC Game Tools. You'll need to create a free NI account.

    FRC Game Tools Guide
  2. Run the Installer

    Extract the downloaded files and run the setup. Install all components including Driver Station and roboRIO Imaging Tool.

  3. License Activation

    When prompted, activate with the free license key provided on the FIRST website using your team number.

🎮 What is Driver Station?

The FRC Driver Station is the software that communicates with your robot during matches. It handles joystick input, displays robot status, and manages enable/disable states.

Step 5

Creating Your First Robot Project

Now that everything is installed, let's create your first robot project using the Command-Based framework.

Creating a Project:

  1. Open WPILib VS Code

    Launch WPILib VS Code 2025 from your applications.

  2. Create New Project

    Press Ctrl+Shift+P (Cmd+Shift+P on Mac) and type 'WPILib: Create a new project'. Select it.

  3. Configure Project Settings
    • Select 'Template' → 'Java' → 'Command Robot'
    • Set your project folder location
    • Enter your team number (e.g., 9236)
    • Give your project a name (e.g., 'MyFirstRobot')
  4. Generate Project

    Click 'Generate Project'. VS Code will create the project structure and open it.

📁 Project Structure

Your project will have:

  • src/main/java/frc/robot/ - Your robot code
  • Robot.java - Main robot class
  • RobotContainer.java - Robot configuration
  • commands/ - Command classes folder
  • subsystems/ - Subsystem classes folder
Step 6

Basic Drive Programming

Let's create a simple drivetrain subsystem and command to control your robot with a joystick.

Creating a Drivetrain Subsystem:

  1. Create Drivetrain.java

    In the subsystems folder, create a new file called Drivetrain.java

  2. Add SPARK MAX Controllers

    Import REVLib and create SPARK MAX objects with the CAN IDs you configured in Step 2:

    import com.revrobotics.spark.SparkMax;
    import com.revrobotics.spark.SparkLowLevel.MotorType;
    
    private final SparkMax leftMotor = new SparkMax(1, MotorType.kBrushless);
    private final SparkMax rightMotor = new SparkMax(2, MotorType.kBrushless);
  3. Create Drive Method

    Add a method to control the motors:

    public void arcadeDrive(double speed, double rotation) {
        leftMotor.set(speed + rotation);
        rightMotor.set(speed - rotation);
    }
  4. Create Drive Command

    In RobotContainer.java, bind the joystick to drive the robot:

    drivetrain.setDefaultCommand(
        new RunCommand(
            () -> drivetrain.arcadeDrive(
                -controller.getLeftY(),
                controller.getRightX()
            ),
            drivetrain
        )
    );

🎯 Understanding Arcade Drive

Arcade drive uses one joystick axis for forward/backward speed and another for rotation. It's the most intuitive control scheme for beginners!

Step 7

Deploying Code to Robot

Now it's time to deploy your code to the actual robot!

Deployment Steps:

  1. Connect to Robot

    Connect your computer to the robot's radio/router via Ethernet or WiFi. The robot should be powered on.

  2. Build the Code

    Press Ctrl+Shift+P and select 'WPILib: Build Robot Code'. Make sure there are no errors.

  3. Deploy to Robot

    Press Ctrl+Shift+P and select 'WPILib: Deploy Robot Code'. The code will compile and upload to the roboRIO.

  4. Test with Driver Station

    Open FRC Driver Station, connect your joystick, enable the robot, and test your drive code!

⚠️ Safety First!

Always test your robot in a safe area with plenty of space. Make sure the robot is on blocks or the wheels are off the ground for initial testing!

🎉 Congratulations!

You've completed the basic software setup! You now have a working robot that can be driven with a joystick. From here, you can add more subsystems, autonomous commands, and advanced features.

Additional Resources