Class LoggedNetworkBoolean
java.lang.Object
org.littletonrobotics.junction.networktables.LoggedNetworkInput
org.littletonrobotics.junction.networktables.LoggedNetworkBoolean
- All Implemented Interfaces:
BooleanSupplier
Manages a boolean value published to the root table of NT.
-
Field Summary
Fields inherited from class org.littletonrobotics.junction.networktables.LoggedNetworkInput
prefix -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new LoggedNetworkBoolean, for handling a boolean input sent via NetworkTables.LoggedNetworkBoolean(String key, boolean defaultValue) Creates a new LoggedNetworkBoolean, for handling a boolean input sent via NetworkTables. -
Method Summary
Modifier and TypeMethodDescriptionbooleanget()Returns the current value.booleanvoidperiodic()Update the current value and save/replay the input.voidset(boolean value) Publishes a new value.voidsetDefault(boolean defaultValue) Updates the default value, which is used if no value in NT is found.Methods inherited from class org.littletonrobotics.junction.networktables.LoggedNetworkInput
removeSlash
-
Constructor Details
-
LoggedNetworkBoolean
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
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 byget()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:LoggedNetworkInputUpdate the current value and save/replay the input. This function should never be called by user code.- Specified by:
periodicin classLoggedNetworkInput
-
getAsBoolean
public boolean getAsBoolean()- Specified by:
getAsBooleanin interfaceBooleanSupplier
-