Class SimLoop
java.lang.Object
frc.spectrumLib.sim.SimLoop
Shared high-frequency simulation loop. Mechanism sims register a step callback and are driven
from a single
Notifier thread far faster than the 50 Hz main loop, so the simulated
TalonFX closed loops advance close to their real ~1 kHz cadence and PID gains behave like
hardware. This mirrors the swerve drivetrain's sim thread.
Sim-only: registration is a no-op on real hardware, so no thread is started on the roboRIO.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidregister(DoubleConsumer step) Registers a step callback, invoked with the real elapsed time (seconds) since the previous tick.
-
Method Details
-
register
Registers a step callback, invoked with the real elapsed time (seconds) since the previous tick. The first registration starts the shared thread. No-op outside simulation.- Parameters:
step- the per-tick update to run
-