Class RuntimeInputs

java.lang.Object
frc.robot.RuntimeInputs
All Implemented Interfaces:
LoggableInputs

public final class RuntimeInputs extends Object implements LoggableInputs
Facts about where the code is running that logic depends on, as an AdvantageKit input.

Replay always runs in Constants.Mode.REPLAY, so code that branches on "is this the simulator?" would take the simulator's branch when replaying a real match. Anything that must behave the way the recorded run did reads this instead: on the robot and in the sim it records the truth; in replay it restores what the recorded run was.

  • Method Details

    • update

      public static void update()
      Records (or in replay, restores) the inputs. Call once per loop, first thing.
    • isSimulation

      public static boolean isSimulation()
      Whether the run being executed (or replayed) is the desktop simulator.
    • batteryVoltage

      public static double batteryVoltage()
      Battery voltage for the run being executed (or replayed).
    • brownedOut

      public static boolean brownedOut()
      Whether the controller is browned out, for the run being executed (or replayed).
    • setBrownoutApiAvailable

      public static void setBrownoutApiAvailable(boolean available)
      Starts reading the brownout state, once the robot has found the API works.
    • toLog

      public void toLog(LogTable table)
      Specified by:
      toLog in interface LoggableInputs
    • fromLog

      public void fromLog(LogTable table)
      Specified by:
      fromLog in interface LoggableInputs