This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is an FRC (FIRST Robotics Competition) robot project using WPILib 2025, AdvantageKit for logging, and CTRE Phoenix 6 for motor control. The project follows a command-based robot architecture with IO abstraction layers for hardware components.
# Windows with WPILib's JDK
JAVA_HOME="C:/Users/Public/wpilib/2025/jdk" ./gradlew build
# Or if JAVA_HOME is already configured
./gradlew build./gradlew test./gradlew spotlessApply # Auto-format code
./gradlew spotlessCheck # Check formatting./gradlew deploy./gradlew simulateJava # Run robot simulation./gradlew replayWatch # Watch log replay- Main Entry:
frc.robot.Main- Entry point, launches Robot class - Robot Class:
frc.robot.Robot- Extends LoggedRobot, initializes AdvantageKit logging - RobotContainer:
frc.robot.RobotContainer- Central configuration for subsystems, commands, and button bindings - Constants:
frc.robot.Constants- Global robot constants and configuration
Each subsystem follows an IO abstraction pattern for hardware independence:
- Subsystem Class: Core logic and command interface (e.g.,
Drive.java) - IO Interface: Hardware abstraction layer (e.g.,
DriveIO.java) - IO Implementations:
- Real hardware (e.g.,
DriveIOTalonFX.java) - Simulation (e.g.,
DriveIOSim.java)
- Real hardware (e.g.,
Current subsystems:
drive/- Swerve drive system with module controlintake/- Game piece intake mechanismshooter/- Shooting mechanismsuperstructure/- Coordinated subsystem controlvision/- Camera and vision processing
- Commands in
frc.robot.commands/ - Uses WPILib's command-based framework
- Factory methods in
DriveCommands.javaandSuperstructureCommands.java
Phoenix 6 uses typed units, not raw doubles:
// CORRECT
StatusSignal<Angle> positionSignal = motor.getPosition();
double rotations = positionSignal.getValue().in(Units.Rotations);
// INCORRECT - Won't compile
StatusSignal<Double> positionSignal = motor.getPosition();Use SupplyCurrentLimit and StatorCurrentLimit, not threshold-based limits.
- All IO operations must log inputs/outputs through AutoLog
- Use
@AutoLogannotation on IO classes - Logger is initialized in Robot constructor
- Java 17 target
- Spotless auto-formatting runs before compilation
- Event branches auto-commit on deploy
- JVM heap limited to 100MB for RoboRIO deployment
- WPILib 2025.3.2
- CTRE Phoenix 6 (latest)
- AdvantageKit (for logging)
- PathPlanner (path following)
- PhotonLib (vision processing)
- Maple-sim (simulation utilities)
- JUnit 5 for unit tests
- Test files located alongside source in standard Maven structure
- Run with
./gradlew test
- Simulation GUI enabled by default
- Supports AdvantageKit log replay
- Simulation implementations available for all major subsystems