Class LoggedNetworkNumber

java.lang.Object
org.littletonrobotics.junction.networktables.LoggedNetworkInput
org.littletonrobotics.junction.networktables.LoggedNetworkNumber
All Implemented Interfaces:
DoubleSupplier

public class LoggedNetworkNumber extends LoggedNetworkInput implements DoubleSupplier
Manages a number value published to the root table of NT.
  • Constructor Details

    • LoggedNetworkNumber

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

      public LoggedNetworkNumber(String key, double defaultValue)
      Creates a new LoggedNetworkNumber, for handling a number 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(double 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(double 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 double 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
    • getAsDouble

      public double getAsDouble()
      Specified by:
      getAsDouble in interface DoubleSupplier