Class Constants

java.lang.Object
frc.robot.Constants

public final class Constants extends Object
AdvantageKit runtime mode. Always Constants.Mode.REAL on SystemCore. On the desktop it is simMode: Constants.Mode.SIM for the physics sim, or Constants.Mode.REPLAY to replay a log (see README, "Replaying a match").
  • Field Details

    • simMode

      public static final Constants.Mode simMode
      Desktop mode. Also settable without editing code: -Dfm.replay=true or the FM_REPLAY=1 environment variable selects replay.
    • currentMode

      public static final Constants.Mode currentMode
    • LOOP_PERIOD_SECONDS

      public static final double LOOP_PERIOD_SECONDS
      Robot loop period. The 2026 roboRIO ran 0.020 (50 Hz) and was often over budget; SystemCore runs the whole cycle in a few milliseconds, so FM runs at 100 Hz. Code that assumes a 20 ms period reads RobotLoop.periodSeconds() instead.
      See Also:
    • MAIN_THREAD_RT_PRIORITY

      public static final int MAIN_THREAD_RT_PRIORITY
      Real-time priority for the robot's main thread on the real robot, 1-99; 0 leaves it as a normal thread. SystemCore shares its four cores with its own camera servers and services (~85% busy on the bench unit), and a normal-priority main thread waits its turn behind them, which shows up as late loops.

      1 is the lowest real-time priority: above every normal process, but below Phoenix's CAN threads (real-time 2-3 on SystemCore, 2026-09-23) and the HAL notifier (40) that wakes the loop. Do not raise it above Phoenix: the 2026 offseason bot ran its main thread at 99 on the roboRIO and starved Phoenix's frame dispatch ("CAN message is stale", WaitForAll -1003, reverted in 2026-Spectrum 704030d).

      Threads the main thread starts after this is set inherit it, so it is applied at the end of robot init; System/TopThreads marks real-time threads with [rt N].

      See Also:
    • TUNING_MODE

      public static final boolean TUNING_MODE
      Tuning mode: dashboards may change params under /Tuning/ (applied while disabled) and save them to the robot, and may change TuneValues. Off, every tunable holds its default or params-file value and nothing is published for tuning. Turn it on for a tuning session only; CI fails a PR to main that leaves it on.
      See Also:
  • Method Details

    • hasHardware

      public static boolean hasHardware()
      Whether hardware (real or simulated) exists, i.e. not replaying.