Class Tunables
java.lang.Object
org.wpilib.tunable.Tunables
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 Summary
Modifier and TypeMethodDescriptionstatic TunableBooleanaddBoolean(String name, boolean initialValue) Creates and publishes a tunable boolean value.static TunableDoubleCreates and publishes a tunable double value.static TunableFloatCreates and publishes a tunable float value.static TunableIntCreates and publishes a tunable integer value.static TunableLongCreates and publishes a tunable long value.static <T> Tunable<T> Creates and publishes a tunable value.static TunableTablegetTable()Gets the root tunable table.static TunableTableGets a child tunable table.static booleanpublish(String name, ComplexTunable tunable) Publishes a complex tunable.static booleanpublish(String name, TunableBase tunable) Publishes a tunable.static TunableBooleanpublishBoolean(String name, BooleanSupplier getter, BooleanConsumer setter) Publishes a tunable boolean value using a getter and setter.static TunableBooleanpublishBoolean(String name, BooleanSupplier getter, BooleanConsumer setter, TunableConfig config) Publishes a tunable boolean value using a getter and setter.static TunableDoublepublishDouble(String name, DoubleSupplier getter, DoubleConsumer setter) Publishes a tunable double value using a getter and setter.static TunableDoublepublishDouble(String name, DoubleSupplier getter, DoubleConsumer setter, TunableConfig config) Publishes a tunable double value using a getter and setter.static TunableFloatpublishFloat(String name, FloatSupplier getter, FloatConsumer setter) Publishes a tunable float value using a getter and setter.static TunableFloatpublishFloat(String name, FloatSupplier getter, FloatConsumer setter, TunableConfig config) Publishes a tunable float value using a getter and setter.static TunableIntpublishInt(String name, IntSupplier getter, IntConsumer setter) Publishes a tunable integer value using a getter and setter.static TunableIntpublishInt(String name, IntSupplier getter, IntConsumer setter, TunableConfig config) Publishes a tunable integer value using a getter and setter.static TunableLongpublishLong(String name, LongSupplier getter, LongConsumer setter) Publishes a tunable long value using a getter and setter.static TunableLongpublishLong(String name, LongSupplier getter, LongConsumer setter, TunableConfig config) Publishes a tunable long value using a getter and setter.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.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.static voidRemoves a tunable.
-
Method Details
-
getTable
-
getTable
Gets a child tunable table.- Parameters:
name- table name- Returns:
- table
-
addValue
-
addBoolean
Creates and publishes a tunable boolean value.- Parameters:
name- the nameinitialValue- the initial value- Returns:
- tunable
-
addInt
Creates and publishes a tunable integer value.- Parameters:
name- the nameinitialValue- the initial value- Returns:
- tunable
-
addLong
Creates and publishes a tunable long value.- Parameters:
name- the nameinitialValue- the initial value- Returns:
- tunable
-
addFloat
Creates and publishes a tunable float value.- Parameters:
name- the nameinitialValue- the initial value- Returns:
- tunable
-
addDouble
Creates and publishes a tunable double value.- Parameters:
name- the nameinitialValue- the initial value- Returns:
- tunable
-
publish
Publishes a tunable.- Parameters:
name- the nametunable- the tunable- Returns:
- true if the backend accepted the tunable
-
publish
Publishes a complex tunable.- Parameters:
name- the nametunable- 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 namegetter- the gettersetter- the settercls- 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 namegetter- the gettersetter- the settercls- the class of the valueconfig- 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 namegetter- the gettersetter- 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 namegetter- the gettersetter- the setterconfig- tunable config- Returns:
- the tunable
-
publishInt
Publishes a tunable integer value using a getter and setter.- Parameters:
name- the namegetter- the gettersetter- 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 namegetter- the gettersetter- the setterconfig- tunable config- Returns:
- the tunable
-
publishLong
Publishes a tunable long value using a getter and setter.- Parameters:
name- the namegetter- the gettersetter- 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 namegetter- the gettersetter- the setterconfig- tunable config- Returns:
- the tunable
-
publishFloat
Publishes a tunable float value using a getter and setter.- Parameters:
name- the namegetter- the gettersetter- 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 namegetter- the gettersetter- the setterconfig- 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 namegetter- the gettersetter- 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 namegetter- the gettersetter- the setterconfig- tunable config- Returns:
- the tunable
-
remove
-