Class RollerSim

java.lang.Object
frc.spectrumLib.sim.RollerSim
All Implemented Interfaces:
Mountable

public class RollerSim extends Object implements Mountable
WPILib-backed simulation of a roller (flywheel) mechanism driven by a single Kraken X60 motor. Updates the TalonFX sim state each robot period and animates the roller — including spin-color feedback — in a Mechanism2d canvas. Implements Mountable so the roller axle can follow a parent Mount.
  • Constructor Details

    • RollerSim

      public RollerSim(RollerConfig config, Mechanism2d mech, TalonFXSimState rollerMotorSim, String name)
      Creates and registers a roller simulation.
      Parameters:
      config - physical and display configuration for the roller
      mech - the Mechanism2d canvas to draw the roller on
      rollerMotorSim - the TalonFX sim state of the motor driving the roller
      name - unique name prefix used for Mechanism2d element labels
  • Method Details

    • simulationPeriodic

      public void simulationPeriodic()
      Advances the flywheel physics simulation by one robot period, updates the TalonFX rotor velocity and position, moves the axle to its current mount position, and updates the Mechanism2d color to reflect the roller's spin direction.