A championship-tier software template for Mountaineer Area RoboticS โ FRC Team 2614.
Welcome to MARSLib, an aggressively hardened framework that enables pure, deterministic AdvantageKit logging while bridging seamless 2D physics simulations via dyn4j.
MARSLib is built upon the _FIRST_ยฎ Core Values. We believe that technical excellence is inseparable from character:
- Discovery & Innovation: We explore new technologies and use creative persistence to solve "impossible" problems.
- Impact & Teamwork: We build together, ensuring our software has a measurable impact on our team's success.
- Inclusion & Fun: We ensure our code and culture are welcoming to all, and we celebrate every breakthrough!
This architecture is built so that students can develop completely offline. Our simulation logic doesn't just run mathematical encodersโit simulates hexagonal REBUILT obstacles, voltage sag limits, and bounding box superstructure collisions.
- 100% Simulated Logic: Run
./gradlew simulateJavaand visualize your robot mathematically navigating the REBUILT field before you even touch a real battery. - Time-Of-Flight Aiming: Native quadratic kinematic intersections mean the robot shoots accurately while pulling full-speed swerve maneuvers.
- Voltage Load-Shedding: A native Stator Current allocation daemon statically bounds TalonFX modules to actively prevent robotic brownouts when pushing against defense.
- Continuous Automation: Every push to GitHub runs a spotless lint check and validates physics-backed JUnit tests against the dyn4j simulation engine before compiling and logging an uploadable JAR.
Full API documentation is available at MARSProgramming.github.io/MARSLib
To generate documentation locally:
./gradlew generateDocs
# Open docs/index.html in your browserThe codebase strictly enforces the AdvantageKit Dependency Injection pattern, isolating the logical robot from the physical/simulated hardware.
graph TD
classDef io fill:#2b66a2,stroke:#1f4a76,stroke-width:2px,color:white;
classDef logic fill:#003f00,stroke:#002900,stroke-width:2px,color:white;
classDef ext fill:#4a4a4a,stroke:#333333,stroke-width:2px,color:white;
Subsystem[Subsystem Logic / State Machines]:::logic
IO[SubsystemIO Interface]:::io
Real[SubsystemIOReal: TalonFX / Limelight / QuestNav]:::ext
Sim[SubsystemIOSim: Dyn4j Physics Engine]:::ext
Log[(AdvantageKit Logger)]:::ext
Subsystem -->|Injects| IO
IO -.->|Physical Robot| Real
IO -.->|Desktop Sim| Sim
Subsystem -->|Records State| Log
MARSLib/
โโโ .github/ # CI Pipelines, Dependabot, and PR Templates
โโโ .wpilib/ # FRC 2614 Team Radio Configurations
โโโ docs/ # Generated documentation site (GitHub Pages)
โโโ com.marslib/ # Inner Architecture (Do Not Edit Routine Logic Here)
โ โโโ auto/ # PathPlanner Integration & Diagnostic Checks
โ โโโ faults/ # MARSFaultManager & Alert System
โ โโโ mechanisms/ # Linear/Rotary/Flywheel IO Abstractions
โ โโโ power/ # MARSPowerManager Load-Shedding Daemon
โ โโโ simulation/ # Dyn4j World Bounds and Hexagonal Meshes
โ โโโ swerve/ # 250Hz Odometry Thread & Odometry Computations
โ โโโ util/ # Time-Of-Flight Interpolation, State Machines, Alliance Utils
โ โโโ vision/ # AprilTag & SLAM Fusion Pipelines
โโโ frc.robot/ # Competition Logic (Edit Your Logic Here!)
โโโ commands/ # PathPlanner routines and Teleop Commands
โโโ constants/ # All tunable parameters (Vision, Field, Shooter, etc.)
โโโ simulation/ # Game Piece Physics Bodies
โโโ subsystems/ # Implementations of your Superstructure/Arm
โโโ RobotContainer.java # Controller Mapping and Subsystem bindings
To ensure your code never gets rejected by GitHub's automated CI, run the included batch script to initialize a spotless Git Hook!
# Windows
.\install-git-hooks.bat(This forces your VS Code to auto-format build.gradle structures before you push!)
MARSLib abstracts the Real hardware from the Sim hardware using pure Dependency Injection interfaces.
SubsystemIO- The Interface (What data does this mechanism need?)SubsystemIOReal- The Hardware (TalonFX / CANSparkMax / NavX)SubsystemIOSim- The Physics (Dyn4j wrappers, friction calculations)
Want to analyze a bug or replay a match?
- Open AdvantageScope
- Click
File > Open Layoutand select theadvantagescope_layout.jsonlocated at the root of this repository! - You now have a fully operational 3D Dashboard monitoring battery voltage limits alongside Hexagonal Field boundaries.
Use our customized GitHub Issue Templates to let the software leads know exactly what went wrong in your simulation or physical robot code! Whether it's a new PathPlanner routine request or an odometry jitter bug, the templates will automatically guide you through attaching your .wpilog telemetry data.
MARSLib stands upon the shoulders of giants. We extend our deepest gratitude to the MapleSim project for their groundbreaking simulation patterns, and to the following open-source maintainers and vendors who make modern FRC possible: