Package org.turbojax
Class TurboLogger
java.lang.Object
org.turbojax.TurboLogger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCreates an alias for a key.static voidCloses the existing DataLog file and resets it to null.static voidenableDataLogs(String logPath) Enables DataLog recording of NT output.static booleanGets a boolean from NetworkTables.static boolean[]Gets a boolean array from NetworkTables.static doubleGets a double from NetworkTables.static double[]Gets a double array from NetworkTables.static floatGets a float from NetworkTables.static float[]Gets a float array from NetworkTables.static intGets an int from NetworkTables.static int[]Gets an int array from NetworkTables.static StringGets a string from NetworkTables.static String[]Gets a string array from NetworkTables.static <T extends StructSerializable>
TGets a struct serialized object from NetworkTables.static <T extends StructSerializable>
T[]Gets an array of struct serialized objects from NetworkTables.static booleanhasChanged(String key) Gets whether or not the logged value has changed since the last time the key was read from.static voidLogs a boolean to NetworkTables.static voidLogs a boolean array to NetworkTables.static voidLogs a double to NetworkTables.static voidLogs a double array to NetworkTables.static voidLogs a float to NetworkTables.static voidLogs a float array to NetworkTables.static voidLogs an int to NetworkTables.static voidLogs an int array to NetworkTables.static voidLogs a string to NetworkTables.static voidLogs a string array to NetworkTables.static <T extends StructSerializable>
voidLogs a struct to NetworkTables.static <T extends StructSerializable>
voidLogs a struct array to NetworkTables.static voidRemoves a key from the logger.static voidremoveAlias(String alias) Removes an alias.
-
Constructor Details
-
TurboLogger
public TurboLogger()
-
-
Method Details
-
enableDataLogs
Enables DataLog recording of NT output.The wpilog is created at the logPath point. If the logPath ends with a forward slash, it is seen as a directory. Otherwise, it is seen as a file.
- Parameters:
logPath- The path to store the logfile at.
-
disableDataLogs
public static void disableDataLogs()Closes the existing DataLog file and resets it to null. -
log
Logs a boolean array to NetworkTables.- Parameters:
key- The key to log the value under. This can be a NetworkTables path or an alias.value- The boolean array to log.
-
log
Logs a boolean to NetworkTables.- Parameters:
key- The key to log the value under. This can be a NetworkTables path or an alias.value- The boolean to log.
-
log
Logs a double array to NetworkTables.- Parameters:
key- The key to log the value under. This can be a NetworkTables path or an alias.value- The double array to log.
-
log
Logs a double to NetworkTables.- Parameters:
key- The key to log the value under. This can be a NetworkTables path or an alias.value- The double to log.
-
log
Logs a float array to NetworkTables.- Parameters:
key- The key to log the value under. This can be a NetworkTables path or an alias.value- The float array to log.
-
log
Logs a float to NetworkTables.- Parameters:
key- The key to log the value under. This can be a NetworkTables path or an alias.value- The float to log.
-
log
Logs an int array to NetworkTables.- Parameters:
key- The key to log the value under. This can be a NetworkTables path or an alias.value- The int array to log.
-
log
Logs an int to NetworkTables.- Parameters:
key- The key to log the value under. This can be a NetworkTables path or an alias.value- The int to log.
-
log
Logs a string array to NetworkTables.- Parameters:
key- The key to log the value under. This can be a NetworkTables path or an alias.value- The string array to log.
-
log
Logs a string to NetworkTables.- Parameters:
key- The key to log the value under. This can be a NetworkTables path or an alias.value- The string to log.
-
log
Logs a struct array to NetworkTables.- Type Parameters:
T- An object to log that implementsStructSerializable.- Parameters:
key- The key to log the value under. This can be a NetworkTables path or an alias.value- The struct array to log.
-
log
Logs a struct to NetworkTables.- Type Parameters:
T- An object to log that implementsStructSerializable.- Parameters:
key- The key to log the value under. This can be a NetworkTables path or an alias.value- The struct to log.
-
get
Gets a boolean array from NetworkTables.- Parameters:
key- The key to find the value under.defaultValue- The value to return if the subscriber doesn't exist.- Returns:
- The boolean array referenced by the key
-
get
Gets a boolean from NetworkTables.- Parameters:
key- The key to find the value under.defaultValue- The value to return if the subscriber doesn't exist.- Returns:
- The boolean referenced by the key.
-
get
Gets a double array from NetworkTables.- Parameters:
key- The key to find the value under.defaultValue- The value to return if the subscriber doesn't exist.- Returns:
- The double array referenced by the key.
-
get
Gets a double from NetworkTables.- Parameters:
key- The key to find the value under.defaultValue- The value to return if the subscriber doesn't exist.- Returns:
- The double referenced by the key.
-
get
Gets a float array from NetworkTables.- Parameters:
key- The key to find the value under.defaultValue- The value to return if the subscriber doesn't exist.- Returns:
- The float array referenced by the key.
-
get
Gets a float from NetworkTables.- Parameters:
key- The key to find the value under.defaultValue- The value to return if the subscriber doesn't exist.- Returns:
- The float referenced by the key.
-
get
Gets an int array from NetworkTables.- Parameters:
key- The key to find the value under.defaultValue- The value to return if the subscriber doesn't exist.- Returns:
- The integer array referenced by the key.
-
get
Gets an int from NetworkTables.- Parameters:
key- The key to find the value under.defaultValue- The value to return if the subscriber doesn't exist.- Returns:
- The int referenced by the key.
-
get
Gets a string array from NetworkTables.- Parameters:
key- The key to find the value under.defaultValue- The value to return if the subscriber doesn't exist.- Returns:
- The string array referenced by the key.
-
get
Gets a string from NetworkTables.- Parameters:
key- The key to find the value under.defaultValue- The value to return if the subscriber doesn't exist.- Returns:
- The string referenced by the key.
-
get
Gets an array of struct serialized objects from NetworkTables.- Type Parameters:
T- An object to log that implementsStructSerializable.- Parameters:
key- The key to find the value under.defaultValue- The value to return if the subscriber doesn't exist.- Returns:
- The array of
StructSerializableobjects referenced by the key.
-
get
Gets a struct serialized object from NetworkTables.- Type Parameters:
T- An object to log that implementsStructSerializable.- Parameters:
key- The key to find the value under.defaultValue- The value to return if the subscriber doesn't exist.- Returns:
- The struct serialized object referenced by the key.
-
hasChanged
Gets whether or not the logged value has changed since the last time the key was read from.- Parameters:
key- The key to check the status of. This can be the path in NetworkTables or an alias.- Returns:
- Whether or not the logged value has changed.
-
remove
Removes a key from the logger.If the key is an alias, it removes the parent NetworkTables path and all other aliases.
- Parameters:
key- The key to remove. It can be an alias or a NetworkTables path.
-
addAlias
Creates an alias for a key. Aliases are accepted as alternatives for the key in the TurboLogger.log or TurboLogger.get methods. They can also increase readability in the code.Aliases have their own entry in the lastRead table. This means that when you get an alias, it does not mark the main key or any other aliases for that key as read.
- Parameters:
ntPath- The path to create an alias for.alias- The alias to add.
-
removeAlias
Removes an alias.This does not remove the parent key or affect any of the other other aliases associated with that key.
- Parameters:
alias- The alias to remove.
-