Class LoggedNetworkBoolean

java.lang.Object
org.littletonrobotics.junction.networktables.LoggedNetworkInput
org.littletonrobotics.junction.networktables.LoggedNetworkBoolean
All Implemented Interfaces:
BooleanSupplier

public class LoggedNetworkBoolean extends LoggedNetworkInput implements BooleanSupplier
Manages a boolean value published to the root table of NT.
  • Constructor Details

    • LoggedNetworkBoolean

      public LoggedNetworkBoolean(String key)
      Creates a new LoggedNetworkBoolean, for handling a boolean input sent via NetworkTables.
      Parameters:
      key - The key for the number, published to the root table of NT or "/DashboardInputs/{key}" when logged.
    • LoggedNetworkBoolean

      public LoggedNetworkBoolean(String key, boolean defaultValue)
      Creates a new LoggedNetworkBoolean, for handling a boolean input sent via NetworkTables.
      Parameters:
      key - The key for the number, published to the root table of NT or "/DashboardInputs/{key}" when logged.
      defaultValue - The default value if no value in NT is found.
  • Method Details

    • setDefault

      public void setDefault(boolean defaultValue)
      Updates the default value, which is used if no value in NT is found.
      Parameters:
      defaultValue - The new default value.
    • set

      public void set(boolean value)
      Publishes a new value. Note that the value will not be returned by get() until the next cycle.
      Parameters:
      value - The new value.
    • get

      public boolean get()
      Returns the current value.
      Returns:
      The current value.
    • periodic

      public void periodic()
      Description copied from class: LoggedNetworkInput
      Update the current value and save/replay the input. This function should never be called by user code.
      Specified by:
      periodic in class LoggedNetworkInput
    • getAsBoolean

      public boolean getAsBoolean()
      Specified by:
      getAsBoolean in interface BooleanSupplier