Class DogLog

java.lang.Object
dev.doglog.DogLog

@ThreadSafe public class DogLog extends Object
A logger based on WPILib's DataLogManager
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final AtomicBoolean
    Whether the logger is enabled.
    protected static final EpochLogger
     
    protected static final LogWriter
     
    protected static final AtomicReference<DogLogOptions>
    The options to use for the logger.
    protected static final Tunable
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    clearFault(@Nullable Enum<?> faultName)
    Reset the count of a fault to 0, and set the alert associated with the fault to inactive if possible.
    static void
    Reset the count of a fault to 0, and set the alert associated with the fault to inactive if possible.
    static void
    Lower the count of a fault by 1, unless it is already at 0.
    static void
    Lower the count of a fault by 1, unless it is already at 0.
    static boolean
    Check if any faults logged using logged using logFault(String) are currently active.
    static boolean
    Check if faults have been logged using logFault(String).
    Get the options used by the logger.
    static boolean
    Returns whether the logger is enabled.
    static void
    log(String key, boolean value)
    Log a boolean.
    static void
    log(String key, boolean @Nullable [] value)
    Log a boolean array.
    static void
    log(String key, double value)
    Log a double.
    static void
    log(String key, double @Nullable [] value)
    Log a double array.
    static void
    log(String key, double @Nullable [] value, @Nullable String unit)
    Log a double array with unit metadata.
    static void
    log(String key, double @Nullable [] value, @Nullable org.wpilib.units.Unit unit)
    Log a double array with unit metadata.
    static void
    log(String key, double value, @Nullable String unit)
    Log a double with unit metadata.
    static void
    log(String key, double value, @Nullable org.wpilib.units.Unit unit)
    Log a double with unit metadata.
    static void
    log(String key, float value)
    Log a float.
    static void
    log(String key, float @Nullable [] value)
    Log a float array.
    static void
    log(String key, float @Nullable [] value, @Nullable String unit)
    Log a float array with unit metadata.
    static void
    log(String key, float value, @Nullable String unit)
    Log a float with unit metadata.
    static void
    log(String key, int @Nullable [] value)
    Log an int array.
    static void
    log(String key, long value)
    Log a long.
    static void
    log(String key, long @Nullable [] value)
    Log a long array.
    static void
    log(String key, long @Nullable [] value, @Nullable String unit)
    Log a long array with unit metadata.
    static void
    log(String key, long value, @Nullable String unit)
    Log a long with unit metadata.
    static <E extends Enum<E>>
    void
    log(String key, @Nullable E value)
    Log an enum.
    static <E extends Enum<E>>
    void
    log(String key, @Nullable E[] value)
    Log an enum array.
    static <T extends org.wpilib.util.WPISerializable>
    void
    log(String key, @Nullable T value)
    Log a struct or protobuf.
    static <T extends org.wpilib.util.struct.StructSerializable>
    void
    log(String key, @Nullable T[] value)
    Log a struct array.
    static void
    log(String key, @Nullable Record value)
    Log a record.
    static void
    log(String key, @Nullable Record[] value)
    Log a record array.
    static void
    log(String key, @Nullable String value)
    Log a string.
    static void
    log(String key, @Nullable String[] value)
    Log a string array.
    static void
    log(String key, @Nullable String value, @Nullable String customTypeString)
    Log a string with a custom type string.
    static void
    logFault(@Nullable Enum<?> faultName)
    Log a fault and create an error type Alert for it.
    static void
    Log a fault and create an error type Alert for it.
    static void
    logFault(@Nullable String faultName, @Nullable org.wpilib.driverstation.Alert.Level alertLevel)
    Log a fault and create an Alert for it at the specified level.
    static void
    setEnabled(boolean newEnabled)
    Set whether the logger is enabled.
    static void
    Update the options used by the logger.
    static void
    setPdh(@Nullable org.wpilib.hardware.power.PowerDistribution pdh)
    Set the PowerDistribution instance to use for logging PDH/PDP data when logging extras is enabled.
    static void
    time(String key)
    Start a timer to track how long an operation takes to execute.
    static void
    Stop a timer started with time(String) and log the duration in seconds to the specified key.
    static void
    Log the current FPGA timestamp.
    static org.wpilib.networktables.BooleanSubscriber
    tunable(String key, boolean defaultValue)
    Create a tunable boolean.
    static org.wpilib.networktables.BooleanSubscriber
    tunable(String key, boolean defaultValue, @Nullable org.wpilib.util.function.BooleanConsumer onChange)
    Create a tunable boolean.
    static org.wpilib.networktables.DoubleSubscriber
    tunable(String key, double defaultValue)
    Create a tunable double.
    static org.wpilib.networktables.DoubleArraySubscriber
    tunable(String key, double[] defaultValue)
    Create a tunable double array.
    static org.wpilib.networktables.DoubleArraySubscriber
    tunable(String key, double[] defaultValue, @Nullable String unit)
    Create a tunable double array with unit metadata.
    static org.wpilib.networktables.DoubleArraySubscriber
    tunable(String key, double[] defaultValue, @Nullable String unit, @Nullable Consumer<double[]> onChange)
    Create a tunable double array with unit metadata.
    static org.wpilib.networktables.DoubleArraySubscriber
    tunable(String key, double[] defaultValue, @Nullable Consumer<double[]> onChange)
    Create a tunable double array.
    static org.wpilib.networktables.DoubleArraySubscriber
    tunable(String key, double[] defaultValue, @Nullable org.wpilib.units.Unit unit)
    Create a tunable double array with unit metadata.
    static org.wpilib.networktables.DoubleArraySubscriber
    tunable(String key, double[] defaultValue, @Nullable org.wpilib.units.Unit unit, @Nullable Consumer<double[]> onChange)
    Create a tunable double array with unit metadata.
    static org.wpilib.networktables.DoubleSubscriber
    tunable(String key, double defaultValue, @Nullable String unit)
    Create a tunable double with unit metadata.
    static org.wpilib.networktables.DoubleSubscriber
    tunable(String key, double defaultValue, @Nullable String unit, @Nullable DoubleConsumer onChange)
    Create a tunable double with unit metadata.
    static org.wpilib.networktables.DoubleSubscriber
    tunable(String key, double defaultValue, @Nullable DoubleConsumer onChange)
    Create a tunable double.
    static org.wpilib.networktables.DoubleSubscriber
    tunable(String key, double defaultValue, @Nullable org.wpilib.units.Unit unit)
    Create a tunable double with unit metadata.
    static org.wpilib.networktables.DoubleSubscriber
    tunable(String key, double defaultValue, @Nullable org.wpilib.units.Unit unit, @Nullable DoubleConsumer onChange)
    Create a tunable double with unit metadata.
    static org.wpilib.networktables.FloatSubscriber
    tunable(String key, float defaultValue)
    Create a tunable float.
    static org.wpilib.networktables.FloatSubscriber
    tunable(String key, float defaultValue, String unit)
    Create a tunable float with unit metadata.
    static org.wpilib.networktables.FloatSubscriber
    tunable(String key, float defaultValue, String unit, @Nullable org.wpilib.util.function.FloatConsumer onChange)
    Create a tunable float with unit metadata.
    static org.wpilib.networktables.FloatSubscriber
    tunable(String key, float defaultValue, @Nullable org.wpilib.units.Unit unit, @Nullable org.wpilib.util.function.FloatConsumer onChange)
    Create a tunable float with unit metadata.
    static org.wpilib.networktables.FloatSubscriber
    tunable(String key, float defaultValue, org.wpilib.units.Unit unit)
    Create a tunable float with unit metadata.
    static org.wpilib.networktables.FloatSubscriber
    tunable(String key, float defaultValue, @Nullable org.wpilib.util.function.FloatConsumer onChange)
    Create a tunable float.
    static org.wpilib.networktables.IntegerSubscriber
    tunable(String key, long defaultValue)
    Create a tunable integer.
    static org.wpilib.networktables.IntegerSubscriber
    tunable(String key, long defaultValue, @Nullable String unit)
    Create a tunable integer with unit metadata.
    static org.wpilib.networktables.IntegerSubscriber
    tunable(String key, long defaultValue, @Nullable String unit, @Nullable LongConsumer onChange)
    Create a tunable integer with unit metadata.
    static org.wpilib.networktables.IntegerSubscriber
    tunable(String key, long defaultValue, @Nullable LongConsumer onChange)
    Create a tunable integer.
    static org.wpilib.networktables.IntegerSubscriber
    tunable(String key, long defaultValue, @Nullable org.wpilib.units.Unit unit)
    Create a tunable integer with unit metadata.
    static org.wpilib.networktables.IntegerSubscriber
    tunable(String key, long defaultValue, @Nullable org.wpilib.units.Unit unit, @Nullable LongConsumer onChange)
    Create a tunable integer with unit metadata.
    static org.wpilib.networktables.StringSubscriber
    tunable(String key, String defaultValue)
    Create a tunable string.
    static org.wpilib.networktables.StringSubscriber
    tunable(String key, String defaultValue, @Nullable Consumer<String> onChange)
    Create a tunable string.
    static org.wpilib.networktables.DoubleSubscriber
    tunable(String key, @Nullable org.wpilib.units.Measure<?> defaultValue, @Nullable DoubleConsumer onChange)
    Create a tunable from a measure, preserving the user-specified unit.
    static org.wpilib.networktables.DoubleSubscriber
    tunable(String key, org.wpilib.units.Measure<?> defaultValue)
    Create a tunable from a measure, preserving the user-specified unit.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • options

      protected static final AtomicReference<DogLogOptions> options
      The options to use for the logger.
    • logger

      protected static final LogWriter logger
    • enabled

      protected static final AtomicBoolean enabled
      Whether the logger is enabled.
    • tunable

      protected static final Tunable tunable
    • epochLogger

      protected static final EpochLogger epochLogger
  • Constructor Details

    • DogLog

      protected DogLog()
  • Method Details

    • clearFault

      public static void clearFault(@Nullable Enum<?> faultName)
      Reset the count of a fault to 0, and set the alert associated with the fault to inactive if possible.
      Parameters:
      faultName - The name of the fault to reset.
    • clearFault

      public static void clearFault(@Nullable String faultName)
      Reset the count of a fault to 0, and set the alert associated with the fault to inactive if possible.
      Parameters:
      faultName - The name of the fault to reset.
    • decreaseFault

      public static void decreaseFault(@Nullable Enum<?> faultName)
      Lower the count of a fault by 1, unless it is already at 0. If there is an alert associated with the fault, it will be set to inactive once the fault's count is 0.
      Parameters:
      faultName - The name of the fault to decrement the count of.
      See Also:
    • decreaseFault

      public static void decreaseFault(@Nullable String faultName)
      Lower the count of a fault by 1, unless it is already at 0. If there is an alert associated with the fault, it will be set to inactive once the fault's count is 0.
      Parameters:
      faultName - The name of the fault to decrement the count of.
      See Also:
    • faultsActive

      public static boolean faultsActive()
      Check if any faults logged using logged using logFault(String) are currently active.
      Returns:
      Whether any faults are currently active.
    • faultsLogged

      public static boolean faultsLogged()
      Check if faults have been logged using logFault(String).
      Returns:
      Whether any faults have been logged.
    • getOptions

      public static DogLogOptions getOptions()
      Get the options used by the logger.
    • isEnabled

      public static boolean isEnabled()
      Returns whether the logger is enabled.
      See Also:
    • log

      public static void log(String key, boolean value)
      Log a boolean.
    • log

      public static void log(String key, boolean @Nullable [] value)
      Log a boolean array.
    • log

      public static void log(String key, double value)
      Log a double.
    • log

      public static void log(String key, double value, @Nullable String unit)
      Log a double with unit metadata.
    • log

      public static void log(String key, double value, @Nullable org.wpilib.units.Unit unit)
      Log a double with unit metadata.
    • log

      public static void log(String key, double @Nullable [] value)
      Log a double array.
    • log

      public static void log(String key, double @Nullable [] value, @Nullable String unit)
      Log a double array with unit metadata.
    • log

      public static void log(String key, double @Nullable [] value, @Nullable org.wpilib.units.Unit unit)
      Log a double array with unit metadata.
    • log

      public static <E extends Enum<E>> void log(String key, @Nullable E value)
      Log an enum.
    • log

      public static <E extends Enum<E>> void log(String key, @Nullable E[] value)
      Log an enum array.
    • log

      public static void log(String key, float value)
      Log a float.
    • log

      public static void log(String key, float value, @Nullable String unit)
      Log a float with unit metadata.
    • log

      public static void log(String key, float @Nullable [] value)
      Log a float array.
    • log

      public static void log(String key, float @Nullable [] value, @Nullable String unit)
      Log a float array with unit metadata.
    • log

      public static void log(String key, int @Nullable [] value)
      Log an int array.
    • log

      public static void log(String key, long value)
      Log a long.
    • log

      public static void log(String key, long value, @Nullable String unit)
      Log a long with unit metadata.
    • log

      public static void log(String key, long @Nullable [] value)
      Log a long array.
    • log

      public static void log(String key, long @Nullable [] value, @Nullable String unit)
      Log a long array with unit metadata.
    • log

      public static void log(String key, @Nullable Record value)
      Log a record.
    • log

      public static void log(String key, @Nullable Record[] value)
      Log a record array.
    • log

      public static void log(String key, @Nullable String value)
      Log a string.
    • log

      public static void log(String key, @Nullable String value, @Nullable String customTypeString)
      Log a string with a custom type string.
    • log

      public static void log(String key, @Nullable String[] value)
      Log a string array.
    • log

      public static <T extends org.wpilib.util.WPISerializable> void log(String key, @Nullable T value)
      Log a struct or protobuf. Struct is preferred, with protobuf used as a fallback.
    • log

      public static <T extends org.wpilib.util.struct.StructSerializable> void log(String key, @Nullable T[] value)
      Log a struct array.
    • logFault

      public static void logFault(@Nullable Enum<?> faultName)
      Log a fault and create an error type Alert for it. The enum will be converted to a string with Enum.name().

      See https://doglog.dev/guides/faults for more information.

      Parameters:
      faultName - The name of the fault to log.
      See Also:
    • logFault

      public static void logFault(@Nullable String faultName)
      Log a fault and create an error type Alert for it.

      See https://doglog.dev/guides/faults for more information.

      Parameters:
      faultName - The name of the fault to log.
      See Also:
    • logFault

      public static void logFault(@Nullable String faultName, @Nullable org.wpilib.driverstation.Alert.Level alertLevel)
      Log a fault and create an Alert for it at the specified level.

      See https://doglog.dev/guides/faults for more information.

      Parameters:
      faultName - The name of the fault to log.
      alertLevel - The level of alert to create for the fault, or null if it should not create an alert
      See Also:
    • setEnabled

      public static void setEnabled(boolean newEnabled)
      Set whether the logger is enabled. If the logger is not enabled, calls to `log()` functions will not do anything.

      By default, the logger is enabled.

    • setOptions

      public static void setOptions(@Nullable DogLogOptions newOptions)
      Update the options used by the logger.

      Example:

      DogLog.setOptions(new DogLogOptions().withCaptureDs(true));

      See https://doglog.dev/reference/logger-options/ for more information.

    • setPdh

      public static void setPdh(@Nullable org.wpilib.hardware.power.PowerDistribution pdh)
      Set the PowerDistribution instance to use for logging PDH/PDP data when logging extras is enabled. If this is set to `null`, no PDH data will be logged. Otherwise, information like battery voltage, device currents, etc. will be logged.

      Example:

      DogLog.setPdh(new PowerDistribution());
      Parameters:
      pdh - The PowerDistribution instance to use for logging PDH/PDP data.
    • time

      public static void time(String key)
      Start a timer to track how long an operation takes to execute. When you call timeEnd(String) the duration of the operation in seconds will be logged to the specified key.
      Parameters:
      key - The key to start the timer for.
      See Also:
    • timeEnd

      public static void timeEnd(String key)
      Stop a timer started with time(String) and log the duration in seconds to the specified key.
      Parameters:
      key - The key to stop the timer for.
      See Also:
    • timestamp

      public static void timestamp(String key)
      Log the current FPGA timestamp. Useful for recording each time a block of code is executed, since timestamps are unique and monotonically increasing.
      Parameters:
      key - The key to log the timestamp to.
    • tunable

      public static org.wpilib.networktables.BooleanSubscriber tunable(String key, boolean defaultValue)
      Create a tunable boolean.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      Returns:
      A BooleanSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.BooleanSubscriber tunable(String key, boolean defaultValue, @Nullable org.wpilib.util.function.BooleanConsumer onChange)
      Create a tunable boolean.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      A BooleanSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.DoubleSubscriber tunable(String key, double defaultValue)
      Create a tunable double.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      Returns:
      A DoubleSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.DoubleSubscriber tunable(String key, double defaultValue, @Nullable DoubleConsumer onChange)
      Create a tunable double.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      A DoubleSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.DoubleSubscriber tunable(String key, double defaultValue, @Nullable String unit)
      Create a tunable double with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      Returns:
      A DoubleSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.DoubleSubscriber tunable(String key, double defaultValue, @Nullable String unit, @Nullable DoubleConsumer onChange)
      Create a tunable double with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      A DoubleSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.DoubleSubscriber tunable(String key, double defaultValue, @Nullable org.wpilib.units.Unit unit)
      Create a tunable double with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      Returns:
      A DoubleSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.DoubleSubscriber tunable(String key, double defaultValue, @Nullable org.wpilib.units.Unit unit, @Nullable DoubleConsumer onChange)
      Create a tunable double with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      A DoubleSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.DoubleArraySubscriber tunable(String key, double[] defaultValue)
      Create a tunable double array.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      Returns:
      A DoubleArraySubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.DoubleArraySubscriber tunable(String key, double[] defaultValue, @Nullable Consumer<double[]> onChange)
      Create a tunable double array.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      A DoubleArraySubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.DoubleArraySubscriber tunable(String key, double[] defaultValue, @Nullable String unit)
      Create a tunable double array with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      Returns:
      A DoubleArraySubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.DoubleArraySubscriber tunable(String key, double[] defaultValue, @Nullable String unit, @Nullable Consumer<double[]> onChange)
      Create a tunable double array with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      A DoubleArraySubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.DoubleArraySubscriber tunable(String key, double[] defaultValue, @Nullable org.wpilib.units.Unit unit)
      Create a tunable double array with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      Returns:
      A DoubleArraySubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.DoubleArraySubscriber tunable(String key, double[] defaultValue, @Nullable org.wpilib.units.Unit unit, @Nullable Consumer<double[]> onChange)
      Create a tunable double array with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      A DoubleArraySubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.FloatSubscriber tunable(String key, float defaultValue)
      Create a tunable float.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      Returns:
      A FloatSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.FloatSubscriber tunable(String key, float defaultValue, @Nullable org.wpilib.util.function.FloatConsumer onChange)
      Create a tunable float.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      A FloatSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.FloatSubscriber tunable(String key, float defaultValue, String unit)
      Create a tunable float with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      Returns:
      A FloatSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.FloatSubscriber tunable(String key, float defaultValue, String unit, @Nullable org.wpilib.util.function.FloatConsumer onChange)
      Create a tunable float with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      A FloatSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.FloatSubscriber tunable(String key, float defaultValue, org.wpilib.units.Unit unit)
      Create a tunable float with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      Returns:
      A FloatSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.FloatSubscriber tunable(String key, float defaultValue, @Nullable org.wpilib.units.Unit unit, @Nullable org.wpilib.util.function.FloatConsumer onChange)
      Create a tunable float with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      A FloatSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.IntegerSubscriber tunable(String key, long defaultValue)
      Create a tunable integer.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      Returns:
      An IntegerSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.IntegerSubscriber tunable(String key, long defaultValue, @Nullable LongConsumer onChange)
      Create a tunable integer.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      An IntegerSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.IntegerSubscriber tunable(String key, long defaultValue, @Nullable String unit)
      Create a tunable integer with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      Returns:
      An IntegerSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.IntegerSubscriber tunable(String key, long defaultValue, @Nullable String unit, @Nullable LongConsumer onChange)
      Create a tunable integer with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      An IntegerSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.IntegerSubscriber tunable(String key, long defaultValue, @Nullable org.wpilib.units.Unit unit)
      Create a tunable integer with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      Returns:
      An IntegerSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.IntegerSubscriber tunable(String key, long defaultValue, @Nullable org.wpilib.units.Unit unit, @Nullable LongConsumer onChange)
      Create a tunable integer with unit metadata.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      unit - The unit for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      An IntegerSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.DoubleSubscriber tunable(String key, org.wpilib.units.Measure<?> defaultValue)
      Create a tunable from a measure, preserving the user-specified unit.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default measure value for the tunable value.
      Returns:
      A DoubleSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.DoubleSubscriber tunable(String key, @Nullable org.wpilib.units.Measure<?> defaultValue, @Nullable DoubleConsumer onChange)
      Create a tunable from a measure, preserving the user-specified unit.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default measure value for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      A DoubleSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.StringSubscriber tunable(String key, String defaultValue)
      Create a tunable string.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      Returns:
      A StringSubscriber used to retrieve the tunable value.
    • tunable

      public static org.wpilib.networktables.StringSubscriber tunable(String key, String defaultValue, @Nullable Consumer<String> onChange)
      Create a tunable string.
      Parameters:
      key - The key for the tunable value.
      defaultValue - The default value for the tunable value.
      onChange - A function to call when the tunable value changes.
      Returns:
      A StringSubscriber used to retrieve the tunable value.