Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/spectrum3847/2026-Spectrum/llms.txt

Use this file to discover all available pages before exploring further.

Simulation lets you run the full robot program on a laptop without any physical hardware. Spectrum’s simulation setup combines WPILib’s Mechanism2d visualization, IronMaple’s REBUILT 2026 game physics, and PhotonVision’s camera simulation so that most robot behaviors — intake, launching, autonomous paths, and pose estimation — can be tested and debugged before touching the real robot.

Benefits of simulation-first development

  • Start early. Programmers can write and test subsystem logic before the robot is assembled.
  • Parallel workflows. Multiple team members can work on different subsystems simultaneously without competing for robot time.
  • Catch logic errors early. A misrouted command or bad state transition is much cheaper to find in simulation than on the field.
  • Safer iteration. Tuning trajectory or state machine logic in sim avoids damaging hardware.
Simulation does not replace hardware testing. Motor response, sensor noise, and mechanical interactions differ between sim and the real robot. Always validate on hardware before competition.

IronMaple season physics

RobotSim.java uses two IronMaple classes specific to the REBUILT 2026 game:
ClassPackagePurpose
RebuiltFuelOnFlyorg.ironmaple.simulation.seasonspecific.rebuilt2026Simulates fuel game pieces as projectiles with trajectory physics
Arena2026Rebuilt (via SimulatedArena)org.ironmaple.simulation.seasonspecific.rebuilt2026Provides the simulated field environment and game piece positions
Game pieces enter the simulation through an IntakeSimulation configured for the robot’s bumper geometry:
private static final IntakeSimulation intakeSimulation =
        RobotBase.isSimulation()
                ? IntakeSimulation.OverTheBumperIntake(
                        "Fuel",
                        Robot.getSwerve().getMapleSimSwerveDrivetrain().mapleSimDrive,
                        Inches.of(29),   // bumper width
                        Inches.of(12),   // intake depth
                        IntakeSimulation.IntakeSide.FRONT,
                        80)              // intake force (N)
                : null;

Launching fuel projectiles in simulation

When the robot fires in simulation, mapleSimCreateFuelProjectile() constructs a RebuiltFuelOnFly projectile using real shot parameters from ShotCalculator:
GamePieceProjectile fuelProjectile =
        new RebuiltFuelOnFly(
                Robot.getSwerve().getRobotPose().getTranslation(),
                new Translation2d(),
                Robot.getSwerve().getCurrentRobotChassisSpeeds(),
                Rotation2d.kZero,
                Inches.of(29),
                MetersPerSecond.of(parameters.flywheelSpeed() * 0.0025),
                Degrees.of(65))
        .withProjectileTrajectoryDisplayCallBack(
                (pose3ds) -> Telemetry.log(
                        "SimShot/FuelProjectileSuccessfulShot",
                        pose3ds.toArray(Pose3d[]::new)),
                (pose3ds) -> Telemetry.log(
                        "SimShot/FuelProjectileUnsuccessfulShot",
                        pose3ds.toArray(Pose3d[]::new)));
SimulatedArena.getInstance().addGamePieceProjectile(fuelProjectile);
Successful and unsuccessful shot trajectories are both logged to AdvantageScope via Telemetry.log.

Mechanism2d visualization

RobotSim builds a side-view (leftView) Mechanism2d canvas published to SmartDashboard under "Sim/LeftView". The robot chassis is drawn as a purple rectangle using chained MechanismLigament2d segments:
public static final Mechanism2d leftView =
        new Mechanism2d(
                Units.inchesToMeters(leftViewWidth),   // 75 in
                Units.inchesToMeters(leftViewHeight)); // 75 in

// In the constructor:
SmartDashboard.putData("Sim/LeftView", RobotSim.leftView);
Subsystem simulations attach their own LinearSim, ArmSim, or RollerSim roots to leftView, so the complete mechanism assembly moves together in AdvantageScope or Elastic Dashboard.

SpectrumLib simulation classes

SpectrumLib provides three mechanism simulation classes used across subsystems:
ClassSimulatesNotes
LinearSimElevator or linear extensionTracks position against motor state
ArmSimRotating armUses angle and gravity compensation
RollerSimSpinning roller or wheelDisplays direction and relative velocity
These classes can be attached to each other to compose multi-stage mechanisms (e.g., a roller mounted to an elevator that is itself mounted to an arm).

PhotonVision camera simulation

VisionSystem.java registers PhotonCameraSim instances with a VisionSystemSim and calls visionSim.update(pose) every simulation cycle. This lets the vision pipeline produce realistic AprilTag detections based on the simulated robot pose. See the vision systems page for full details.

Running simulation

1

Open the project in VS Code

Ensure the WPILib extension is installed and the project builds without errors.
2

Launch simulation

Press Ctrl+Shift+P and run WPILib: Simulate Robot Code, or click the WPILib icon and select Simulate Robot Code.
3

Connect a driver station

Open the FRC Driver Station (or use the simulated DS). Enable the robot in autonomous or teleop to trigger the relevant init methods.
4

View mechanisms

Open AdvantageScope or Elastic Dashboard and connect to the simulated NetworkTables server at localhost. Navigate to SmartDashboard/Sim/LeftView to see the mechanism canvas.

What simulation covers and does not cover

CoveredNot covered
Command scheduling and state machine logicReal motor torque and electrical behavior
PathPlanner path followingSensor drift and encoder noise
IronMaple fuel projectile physicsVision accuracy on real field lighting
PhotonVision AprilTag detectionsMechanical compliance and friction
Telemetry and log outputCAN bus latency and brownouts

Vision systems

PhotonVision camera simulation and AprilTag field layout configuration.

Logging and telemetry

How simulation shot trajectories and mechanism states are captured in logs.

Build docs developers (and LLMs) love