Robot Code
This guide walks new programmers through contributing to our FRC robot codebase. You’ll install the same tools the programming subteam uses, clone the repository, understand the layout, and follow the workflow for proposing changes.
Required Tooling
Section titled “Required Tooling”IntelliJ IDEA + WPILib Extensions
- Download IntelliJ IDEA (Community or Ultimate) from jetbrains.com/idea/download.
- Install the WPILib and Gradle plugins (WPILib uses GradleRIO behind the scenes).
Install WPILib tools separately for Driver Station integration:
https://github.com/wpilibsuite/allwpilib/releases
Java 17 (Temurin)
- Download Temurin OpenJDK 17 MSI/PKG from adoptium.net.
- Install with defaults and ensure
JAVA_HOMEis set to the installed path. Verify the toolchain:
java -version javac -version
Git + GitHub CLI (optional)
- Install Git from git-scm.com (or via Homebrew/winget).
Configure your identity:
git config —global user.name “Your Name” git config —global user.email “you@team4504.org”- Install GitHub CLI if you prefer pushing/PRs from terminal.
Vendor & Driver Tools
- Install the latest CTRE Phoenix Tuner (for Talon / Victor controllers) and REV Hardware Client (for Spark MAX).
- Keep the roboRIO imaging tool (bundled with WPILib) handy for deploy day.
- Optional: install FRC Driver Station on your dev laptop for quick tethered testing.
Clone & Build the Robot Code
Section titled “Clone & Build the Robot Code”-
Pick a working directory and clone the robot repository (replace with the actual repo name if different):
Terminal window git clone https://github.com/BC-Robotics-4504/robot-code.gitcd robot-code -
Import the project into IntelliJ:
- From the Welcome screen choose Open, select the
robot-codefolder. - Let IntelliJ finish syncing Gradle (watch the status bar).
- From the Welcome screen choose Open, select the
-
Run the initial dependency download:
Terminal window ./gradlew vendorDeps./gradlew buildThe first build pulls WPILib and vendor libraries into
~/.gradle. -
Configure the WPILib project settings:
WPILib Preferences→ set Team Number to 4504 so deploy targets the right roboRIO.- Confirm
Simulationsettings match your operating system (GUI enabled).
-
Start a simulation test to verify everything works:
Terminal window ./gradlew simulateJava -
For Windows devs, run IntelliJ inside WSL 2 or make sure the WPILib tools have USB access if deploying over USB.
Project Layout & Coding Guidelines
Section titled “Project Layout & Coding Guidelines”src/main/java/frc/robotConstants.java: only place for robot-wide constants. Keep fieldspublic static final.subsystems/: classes extendingSubsystemBasethat control hardware (Drivetrain, Shooter, etc.).commands/:Commandimplementations referencing subsystems and operator controls.RobotContainer.java: binds commands to joystick buttons and schedules default commands.
src/main/deploy/: files copied to the roboRIO filesystem (paths, JSON configs).src/test/java: JUnit tests (useGradleRIO’s test runner). Add tests for math helpers, path planners, etc.vendordeps/: JSON definitions for CTRE/REV. Commit these files when updating vendor libraries.
Basic rules:
- One subsystem per hardware group.- No hardware references from commands other than through subsystem APIs.- Keep blocking `Thread.sleep` out of robot code; use `Command::waitSeconds`.- Document new commands/subsystems with short class Javadoc + inline comments when logic is tricky.Day-to-Day Workflow
Section titled “Day-to-Day Workflow”-
Make sure
mainis current:Terminal window git checkout maingit pull origin main -
Create a branch for your task (ex: new auto routine):
Terminal window git checkout -b feat/add-4-note-auto
-
Implement the feature:
- Add or update subsystems/commands/constants as needed.
- Update
RobotContainerbindings. - Document operator instructions in the
readmeor driver notes if required.
-
Test locally:
./gradlew testfor unit tests../gradlew simulateJavafor logic validation.- Deploy to a practice robot with
./gradlew deploy(requires network to roboRIO).
-
Review diffs and commit:
Terminal window git statusgit add src/main/java/frc/robot/subsystems/Drivetrain.javagit commit -m "feat: add swerve teleop hold heading" -
Push and open a PR:
Terminal window git push -u origin feat/add-4-note-autogh pr create --fill # optional GitHub CLI helper -
Request at least one reviewer from the programming lead. Incorporate feedback, re-run tests, and mark the PR ready to merge.
Deploy Checklist
Section titled “Deploy Checklist”- Branch rebased/merged with latest
main. -
./gradlew buildpasses. - Simulation behaves as expected.
- Tested on physical robot (if hardware change).
- Driver station notes updated if controls changed.
- Pull request approved and merged via GitHub.
Following these steps keeps the robot codebase stable and ensures everyone can reproduce your environment quickly. Welcome to the programming team! 🚀