Class Tunables

java.lang.Object
org.wpilib.tunable.Tunables

public final class Tunables extends Object
Tunables are used to allow values in the robot program to be changed from dashboards or debug tools.

Getter/setter-backed publish methods take getters and setters that must not throw.

For more advanced use cases, use NetworkTables directly.

  • Method Details

    • getTable

      public static TunableTable getTable()
      Gets the root tunable table.
      Returns:
      table
    • getTable

      public static TunableTable getTable(String name)
      Gets a child tunable table.
      Parameters:
      name - table name
      Returns:
      table
    • addValue

      public static <T> Tunable<T> addValue(String name, T initialValue)
      Creates and publishes a tunable value.
      Type Parameters:
      T - value type
      Parameters:
      name - the name
      initialValue - the initial value
      Returns:
      tunable
    • addBoolean

      public static TunableBoolean addBoolean(String name, boolean initialValue)
      Creates and publishes a tunable boolean value.
      Parameters:
      name - the name
      initialValue - the initial value
      Returns:
      tunable
    • addInt

      public static TunableInt addInt(String name, int initialValue)
      Creates and publishes a tunable integer value.
      Parameters:
      name - the name
      initialValue - the initial value
      Returns:
      tunable
    • addLong

      public static TunableLong addLong(String name, long initialValue)
      Creates and publishes a tunable long value.
      Parameters:
      name - the name
      initialValue - the initial value
      Returns:
      tunable
    • addFloat

      public static TunableFloat addFloat(String name, float initialValue)
      Creates and publishes a tunable float value.
      Parameters:
      name - the name
      initialValue - the initial value
      Returns:
      tunable
    • addDouble

      public static TunableDouble addDouble(String name, double initialValue)
      Creates and publishes a tunable double value.
      Parameters:
      name - the name
      initialValue - the initial value
      Returns:
      tunable
    • publish

      public static boolean publish(String name, TunableBase tunable)
      Publishes a tunable.
      Parameters:
      name - the name
      tunable - the tunable
      Returns:
      true if the backend accepted the tunable
    • publish

      public static boolean publish(String name, ComplexTunable tunable)
      Publishes a complex tunable.
      Parameters:
      name - the name
      tunable - the tunable
      Returns:
      true if the backend accepted the tunable
    • publishValue

      public static <T> Tunable<T> publishValue(String name, Supplier<T> getter, Consumer<T> setter, Class<T> cls)
      Publishes a tunable value using a getter and setter.
      Type Parameters:
      T - value type
      Parameters:
      name - the name
      getter - the getter
      setter - the setter
      cls - the class of the value
      Returns:
      the tunable
    • publishValue

      public static <T> Tunable<T> publishValue(String name, Supplier<T> getter, Consumer<T> setter, Class<T> cls, TunableConfig config)
      Publishes a tunable value using a getter and setter.
      Type Parameters:
      T - value type
      Parameters:
      name - the name
      getter - the getter
      setter - the setter
      cls - the class of the value
      config - tunable config
      Returns:
      the tunable
    • publishBoolean

      public static TunableBoolean publishBoolean(String name, BooleanSupplier getter, BooleanConsumer setter)
      Publishes a tunable boolean value using a getter and setter.
      Parameters:
      name - the name
      getter - the getter
      setter - the setter
      Returns:
      the tunable
    • publishBoolean

      public static TunableBoolean publishBoolean(String name, BooleanSupplier getter, BooleanConsumer setter, TunableConfig config)
      Publishes a tunable boolean value using a getter and setter.
      Parameters:
      name - the name
      getter - the getter
      setter - the setter
      config - tunable config
      Returns:
      the tunable
    • publishInt

      public static TunableInt publishInt(String name, IntSupplier getter, IntConsumer setter)
      Publishes a tunable integer value using a getter and setter.
      Parameters:
      name - the name
      getter - the getter
      setter - the setter
      Returns:
      the tunable
    • publishInt

      public static TunableInt publishInt(String name, IntSupplier getter, IntConsumer setter, TunableConfig config)
      Publishes a tunable integer value using a getter and setter.
      Parameters:
      name - the name
      getter - the getter
      setter - the setter
      config - tunable config
      Returns:
      the tunable
    • publishLong

      public static TunableLong publishLong(String name, LongSupplier getter, LongConsumer setter)
      Publishes a tunable long value using a getter and setter.
      Parameters:
      name - the name
      getter - the getter
      setter - the setter
      Returns:
      the tunable
    • publishLong

      public static TunableLong publishLong(String name, LongSupplier getter, LongConsumer setter, TunableConfig config)
      Publishes a tunable long value using a getter and setter.
      Parameters:
      name - the name
      getter - the getter
      setter - the setter
      config - tunable config
      Returns:
      the tunable
    • publishFloat

      public static TunableFloat publishFloat(String name, FloatSupplier getter, FloatConsumer setter)
      Publishes a tunable float value using a getter and setter.
      Parameters:
      name - the name
      getter - the getter
      setter - the setter
      Returns:
      the tunable
    • publishFloat

      public static TunableFloat publishFloat(String name, FloatSupplier getter, FloatConsumer setter, TunableConfig config)
      Publishes a tunable float value using a getter and setter.
      Parameters:
      name - the name
      getter - the getter
      setter - the setter
      config - tunable config
      Returns:
      the tunable
    • publishDouble

      public static TunableDouble publishDouble(String name, DoubleSupplier getter, DoubleConsumer setter)
      Publishes a tunable double value using a getter and setter.
      Parameters:
      name - the name
      getter - the getter
      setter - the setter
      Returns:
      the tunable
    • publishDouble

      public static TunableDouble publishDouble(String name, DoubleSupplier getter, DoubleConsumer setter, TunableConfig config)
      Publishes a tunable double value using a getter and setter.
      Parameters:
      name - the name
      getter - the getter
      setter - the setter
      config - tunable config
      Returns:
      the tunable
    • remove

      public static void remove(String name)
      Removes a tunable.
      Parameters:
      name - the name