Class LoggedNetworkNumber
java.lang.Object
org.littletonrobotics.junction.networktables.LoggedNetworkInput
org.littletonrobotics.junction.networktables.LoggedNetworkNumber
- All Implemented Interfaces:
DoubleSupplier
Manages a number 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 LoggedNetworkNumber, for handling a number input sent via NetworkTables.LoggedNetworkNumber(String key, double defaultValue) Creates a new LoggedNetworkNumber, for handling a number input sent via NetworkTables. -
Method Summary
Modifier and TypeMethodDescriptiondoubleget()Returns the current value.doublevoidperiodic()Update the current value and save/replay the input.voidset(double value) Publishes a new value.voidsetDefault(double 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
-
LoggedNetworkNumber
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
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 byget()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:LoggedNetworkInputUpdate the current value and save/replay the input. This function should never be called by user code.- Specified by:
periodicin classLoggedNetworkInput
-
getAsDouble
public double getAsDouble()- Specified by:
getAsDoublein interfaceDoubleSupplier
-