Package frc.spectrumLib.sim
Class RollerSim
java.lang.Object
frc.spectrumLib.sim.RollerSim
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionRollerSim(RollerConfig config, Mechanism2d mech, TalonFXSimState rollerMotorSim, String name) Creates and registers a roller simulation. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdvances 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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface frc.spectrumLib.sim.Mountable
getUpdatedX, getUpdatedX, getUpdatedX, getUpdatedX, getUpdatedY, getUpdatedY, getUpdatedY, getUpdatedY
-
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 rollermech- the Mechanism2d canvas to draw the roller onrollerMotorSim- the TalonFX sim state of the motor driving the rollername- 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.
-