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.
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: