Team 254's 2025 FRC robot code for Undertow. Our robot's code is written in Java and is based off of WPILib's Java control system.
The code is divided into several packages, each responsible for a different aspect of the robot function. This README explains setup instructions, the function of each package, and some of the variable naming conventions used. Additional information about each specific class can be found in that class' Java file.
- Clone this repo
- Run
./gradlewto download gradle and needed FRC/Vendor libraries - Run
./gradlew tasksto see available options - Enjoy!
- Get the WPILib extension for easiest use from the VSCode Marketplace - Requires Java 17 or greater
- In
.vscode/settings.json, set the User Setting,java.home, to the correct directory pointing to your JDK 17 directory
- Run
./gradlew deployto deploy to the robot in Terminal (*nix) or Powershell (Windows) - Run
./gradlew buildto build the code. Use the--infoflag for more details
- To simulate the robot run
./gradlew simulateJavaRelease - You will need to configure your keyboard settings for 1 Xbox Controller.
- To set up 3d visualization in AdvantageScope, import the
2025 AdvantageScope Layout.json.- If the JSON import does not work, you need to set up a 3D tab as follows:
- 3D Poses: Robot (components) : NT: "ComponentsPoseArray"
- 3D Poses: Robot : NT: "Drive/Viz/Pose3d"
- 3D Poses: Coral : NT: "Sim/HeldCoral/Pose3d"
- 3D Poses: Algae : NT: "Sim/HeldAlgae/Pose3d"
- If the JSON import does not work, you need to set up a 3D tab as follows:
-
Modal Control System
The robot uses a sophisticated modal control system to adapt behavior based on the current game objective. The system includes multiple modes for handling both coral and algae game pieces:
- CORAL - Ground and Human Player station coral intake, automatic staging and scoring at reef branches
- ALGAECLIMB - Algae intake and processing, with climbing functionality for end-game
- CORALMANUAL - Manual coral control for precise positioning and recovery scenarios
The SuperstructureStateMachine coordinates all subsystems to achieve complex multi-step actions while the ModalControls system allows drivers to seamlessly switch between different robot behaviors.
-
Intelligent Pathfinding Autonomous
The robot features advanced pathfinding autonomous capabilities using A* pathfinding with dynamic obstacle avoidance. The PathfindingAuto system allows for:
- Dynamic route planning around field obstacles (reefs, coral stations, other robots)
- Configurable autonomous sequences with multiple starting positions and scoring strategies
- Real-time path recalculation based on game piece acquisition success
- Feeder strategy selection for coordinated alliance play
The autonomous uses pre-generated navigation grids and supports multiple game piece priorities and scoring levels, adapting to match conditions in real-time.
-
Advanced Coral and Algae Handling
Our robot precisely handles both coral and algae game pieces with sophisticated state tracking:
- CoralStateTracker monitors coral position throughout the robot (intake → indexer → claw → staged)
- Automatic scoring height selection (L1-L4) based on reef branch availability
- Precise algae processing and barge/processor scoring
- Coordinated intake, indexer, and claw subsystems for reliable game piece control
The system includes comprehensive sensor integration and state machine logic to handle complex game piece interactions and scoring scenarios.
-
AdvantageScope Simulation & Logging
We use AdvantageScope extensively for both simulation and match analysis:
- Full robot 3D visualization with articulating mechanisms (claw, wrist, elevator, intake)
- Real-time coral and algae tracking throughout the robot systems
- Comprehensive logging via AdvantageKit for post-match analysis
- Simulated game piece physics for intake and scoring validation
The SimulatedRobotState provides accurate game piece simulation including coral funnel behavior, reef branch contact detection, and climbing simulation.
-
Precision Auto-Alignment
The robot features multiple auto-alignment capabilities for accurate scoring:
- Auto-align to reef branches for precise coral placement
- Feeder station alignment for Human Player coral intake
- Processor and barge alignment for algae scoring
- Dynamic target selection based on field position and alliance strategy
-
Contains the robot's central functions and holds a class with all numerical constants used throughout the code (see
Constants.java). TheRobotContainerclass controls all routines depending on the robot mode, while theRobotStateclass tracks the current position of the robot and game pieces. -
Contains autonomous mode selection and pathfinding autonomous commands. Includes sophisticated auto mode selection with starting positions, feeder strategies, and scoring sequences.
-
Contains autonomous commands, drive commands, and other complex robot behaviors including auto-alignment and manual control commands.
-
com.team254.frc2025.controlboardContains driver control interfaces including modal controls for switching between coral, algae, and manual modes. Supports both joystick and gamepad configurations.
-
Contains command factories for complex subsystem coordination, including superstructure state management and auto-alignment functionality.
-
com.team254.frc2025.simulationContains simulation code for robot state, game piece physics, and field interaction modeling used in AdvantageScope visualization.
-
com.team254.frc2025.subsystemsContains code for all robot subsystems including drive, intake, indexer, claw, wrist, elevator, climber, and vision. Each subsystem implements the AdvantageKit IO pattern with separate hardware and simulation interfaces.
-
Contains utility classes for swerve drive simulation and other robot-specific helper functions.
-
Contains visualization code for AdvantageScope including robot pose visualization and reef structure rendering.
-
Contains enhanced command utilities including ChezyRepeatCommand and ChezySequenceCommandGroup for complex command composition.
-
Contains CAN device utilities and hardware abstraction layers including CANDeviceId for device identification.
-
Contains Limelight camera integration for vision-based localization and targeting, including LimelightHelpers utility class.
-
Contains enhanced PathPlanner integration with custom A* pathfinding, improved PID control, and advanced trajectory following capabilities.
-
Contains 2025 Reefscape game-specific utilities including reef branch calculations and scoring location management.
-
Contains base subsystem templates and motor control abstractions used throughout the robot code, including servo motor subsystems with CANCoder support.
-
Contains robot timing utilities for consistent time measurement across different execution contexts.
-
Contains utility classes including field constants, mathematical helpers, CAN logging, and various robot-specific calculations.
The codebase follows a clean separation between robot-specific code (com.team254.frc2025.*) and reusable library code (com.team254.lib.*). The library packages provide abstractions and utilities that could be reused across different robot projects.
This project uses Gradle with WPILib's GradleRIO plugin version 2025.3.2. The build system automatically handles dependency management for FRC libraries and vendor dependencies.
- k[A-Z]*** (i.e.
kDriveWheelbaseMeters): Final constants, especially those found in theConstants.javafile. Constants follow the pattern of lowercase 'k' followed by a capital letter and descriptive name in camelCase.
- Team 254 code: MIT — see
LICENSE. - WPILib: BSD — see
WPILib-License.md. - PathPlanner: MIT — see
PathPlanner-License.md.