This repository contains the foundational code architecture for Team 8736. It is designed to be the starting point for each new competition season, allowing us to build reliable, maintainable, and sophisticated robot code faster.
Note: This repository is a foundational framework. Do not commit game-specific code directly here. Use this to start your new season's project.
The goal of this architecture is to solve common problems once, so we can focus on new challenges each year. Our core principles are:
- Modularity: Each robot mechanism (e.g., Drivetrain, Intake, Arm) is an isolated
Subsystem. - Reusability: Code for common components (e.g., PID controllers, logging, motor wrappers) is built here and reused.
- Testability: The architecture is structured to support unit Testing and simulation to verify logic without a physical robot.
- Clarity: We enforce a strict code structure and style guide to make code easy to read and understand for new members.
This framework provides several key features out-of-the-box:
- Advanced Logging: A built-in logging utility that [e.g., writes to NetworkTables and integrates with AdvantageScope].
- Constants Management: A centralized
Constants.javastructure that separates tuning values from logic, with different sets of constants for the competition robot vs. the offseason robot. - Modules: Common helper functions for pose estimators and PID controllers.
Follow these steps to start your new season's codebase from this architecture.
-
Create a new, blank repository on GitHub for your new season.
- Name it
8736-FRC-[Year]-[GameName](e.g.,8736-FRC-2024-Crescendo).
- Name it
-
Clone this architecture repository to your local machine.
git clone https://github.com/Mechanisms-Robotics/modular-robot-reference-architecture.git
This will create a folder named
[architecture-repo-name]. -
Navigate into the cloned directory.
cd [architecture-repo-name] -
Rename the remote from
origin(which points to this repo) totemplate.git remote rename origin template
-
Link your new season's repository as the new
origin.git remote add origin [URL-of-your-new-empty-repo.git]
-
Push the code to your new season's repository.
git push -u origin main
(You may need to use
-for--forcefor the first push if your new repo is not completely empty). -
Build the Project:
- Open the cloned folder in WPILib VS Code.
- Run the
WPILib: Build Robot Codecommand from the command palette (Ctrl+Shift+P). - Ensure it builds successfully before making any changes.
All code contributed to this repository (and to season repositories) must follow the team's official coding standards. This is critical for maintainability and onboarding new members.
➡️ Find the official Team 8736 Coding Standards here
Here is the standard workflow for adding a new part to the robot using this architecture:
- Create a new file:
src/main/java/frc/robot/subsystems/IntakeSubsystem.java - Add your hardware components (motors, sensors) as private variables.
- Write public methods for all actions (e.g.,
runIntake(),stopIntake()). - Implement any required methods from the base class (like
periodic()orlogData()).
- TODO: fill this in
- Create new files in
src/main/java/frc/robot/commands/for intake actions (e.g.,RunIntake.java,StopIntake.java). - In your command,
requiretheIntakeSubsystemin the constructor. - Call the subsystem's public methods in the
execute()andend()methods.
- In
src/main/a/frc/robot/RobotContainer.java, create a new private final instance of yourIntakeSubsystem.private final IntakeSubsystem m_intake = new IntakeSubsystem();
- In the
RobotContainerconstructor, use theconfigureButtonBindings()method to link a controller button to your new commands.private void configureButtonBindings() { // ...other bindings... m_operatorController.a().onTrue(new RunIntake(m_intake, IntakeConstants.kDefaultIntakeSpeed)); m_operatorController.a().onFalse(new StopIntake(m_intake)); }
This is a foundational repository, so changes must be reviewed carefully.
- DO NOT push directly to the
mainbranch. - Create a new branch for your feature or bugfix (e.g.,
feature/new-logging-utilorfix/swerve-bug). - Follow the Team 8736 Coding Standards.
- Write clear comments for all new methods.
- Submit a Pull Request (PR) and request a review from a mentor and other programmers.