Skip to content

Core structure

MARSLib is built using a “Hardware Abstraction Layer” (like a universal remote control) that lets you swap out motors without rewriting your code. We built the framework to reuse memory instead of constantly creating new objects (called “zero-allocation”), which stops the robot from lagging. Because of this, whether you are running a real robot or a simulated one, the math behaves the exact same way.

    
%%{init: {'themeVariables': { 'edgeLabelBackground':'#111111', 'tertiaryTextColor':'#ffffff' } } }%%
flowchart TD
  Z["User Project<br/>(RobotContainer.java)"] -->|Depends On| A("MARSLib Framework<br/>(Vendor Dependency)")
  A --> C[Swerve Subsystem]
  A --> D[Mechanisms]
  A --> E[System Utilities]
  C <--> F{"IO Abstraction Layer"}
  D <--> F
  E <--> F
  F <-->|Hardware Mode| G["IOReal<br/>(TalonFX, Pigeon2)"]
  F <-->|Simulation Mode| H["IOSim<br/>(Dyn4j Physics)"]
  G --> I[("AdvantageKit Log")]
  H --> I[("AdvantageKit Log")]
  style Z fill:#0a0a0a,stroke:#2a2a2a,stroke-width:2px,color:#e8e8e8
  style A fill:#141414,stroke:#B32416,stroke-width:2px,color:#e8e8e8
  style C fill:#1a1a1a,stroke:#2a2a2a,stroke-width:1px,color:#e8e8e8
  style D fill:#1a1a1a,stroke:#2a2a2a,stroke-width:1px,color:#e8e8e8
  style E fill:#1a1a1a,stroke:#2a2a2a,stroke-width:1px,color:#e8e8e8
  style F fill:#B32416,stroke:#d42e1e,stroke-width:2px,color:#fff
  style G fill:#2a2a2a,stroke:#1a1a1a,stroke-width:1px,color:#29b6f6
  style H fill:#2a2a2a,stroke:#1a1a1a,stroke-width:1px,color:#9c7bcc
  style I fill:#0a0a0a,stroke:#6ba3d6,stroke-width:2px,color:#6ba3d6

  

Core framework packages and their responsibilities.

PackageDescriptionKey Classes
com.marslib.swerve250Hz odometry, swerve kinematics, traction controlSwerveDrive, SwerveModule, PhoenixOdometryThread
com.marslib.visionAprilTag localization with MegaTag 2.0 fusionMARSVision, VisionIO
com.marslib.mechanismsGeneric IO abstractionsRotaryMechanismIO, LinearMechanismIO
com.marslib.faultsThread-safe fault reportingMARSFaultManager, Alert
com.marslib.simulationDyn4j physics world, game piece spawningMARSPhysicsWorld, GamePieceBody
com.marslib.powerVoltage load-shedding and stator monitoringMARSPowerManager
com.marslib.utilState machines, tunable numbers, shot mathMARSStateMachine, EliteShooterMath
com.marslib.autoPathPlanner integration, alignment commandsMARSAutoBuilder
frc.robotCompetition logic: RobotContainer, commandsRobotContainer, MARSSuperstructure