Class SimLoop

java.lang.Object
frc.spectrumLib.sim.SimLoop

public final class SimLoop extends Object
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 Details

    • register

      public static void register(DoubleConsumer step)
      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