Class TelemetryTable
For more advanced use cases, use the NetworkTables or DataLog APIs.
-
Constructor Summary
ConstructorsConstructorDescriptionTelemetryTable(TelemetryBackend backend) Constructs a root telemetry table that writes directly to a backend without using the global telemetry registry. -
Method Summary
Modifier and TypeMethodDescriptiongetPath()Gets the table path.Gets a child telemetry table.getType()Gets the table type.voidkeepDuplicates(String name) Indicates duplicate values should be preserved.voidLogs a boolean.voidLogs a boolean array.voidLogs a byte.voidLogs a raw value (byte array).voidLogs a raw value (byte array) with a custom type string.voidLogs a double.voidLogs a double array.voidLogs a float.voidLogs a float array.voidLogs an int.voidLogs an int array.voidLogs a long.voidLogs a long array.voidLogs a short.voidLogs a short array.voidLogs a String.voidLogs a String array.voidLogs a String with a custom type string.voidlog(String name, Collection<?> value) Rejects logging a collection without an explicit element type.voidlog(String name, Collection<?> value, Class<?> elementType) Logs a collection with an explicit element type.<T> voidlog(String name, Collection<T> value, Struct<? super T> struct) Logs a collection of objects with a Struct serializer.<T> voidLogs a generic object.<T> voidLogs a generic array.<T> voidLogs an array of objects with a Struct serializer.<T> voidLogs an object with a Protobuf serializer.<T> voidLogs an object with a Struct serializer.voidsetProperty(String name, String key, String value) Sets property for a value.booleanSets the table type.
-
Constructor Details
-
TelemetryTable
Constructs a root telemetry table that writes directly to a backend without using the global telemetry registry.- Parameters:
backend- telemetry backend
-
-
Method Details
-
getPath
-
setType
Sets the table type. TelemetryLoggable implementations can use this function to communicate the type of data in the table. Callers should check the return value and not log data if false is returned.- Parameters:
typeString- type string- Returns:
- False if type mismatch.
-
getType
Gets the table type.- Returns:
- Table type as set by setType(), or null if none set.
-
getTable
Gets a child telemetry table.- Parameters:
name- table name- Returns:
- table
-
keepDuplicates
Indicates duplicate values should be preserved. Normally duplicate values are ignored.- Parameters:
name- the name
-
setProperty
-
log
Logs a generic object.For non-null values, the value is dispatched in this order:
TelemetryLoggable,StructSerializable,ProtobufSerializable, boxed primitive and string types, and finally handlers registered withTelemetryRegistry.registerTypeHandler(Class, TelemetryRegistry.TypeHandler).TelemetryLoggablevalues are logged to a child table namedname. Struct and protobuf serializable values are logged with their public staticstructorprotoserializers.Boolean,Float,Double,Byte,Short,Integer,Long, otherNumbervalues, andStringare logged as primitive or string entries. GenericNumbervalues other than boxed integral types are logged as double entries. If no registered handler matches, the value falls back to being logged as a string usingObject.toString(). Collection values must be logged with an explicit element type.- Type Parameters:
T- data type- Parameters:
name- the namevalue- the value; must be non-null
-
log
-
log
-
log
-
log
-
log
Rejects logging a collection without an explicit element type.Use
log(String, Collection, Class)orlog(String, Collection, Struct)instead.- Parameters:
name- the namevalue- the value- Throws:
CollectionElementTypeRequiredException- always
-
log
Logs a collection with an explicit element type.The element type selects the backend representation.
Byteelement types are logged as raw byte arrays.Boolean,Float,Double, andStringelement types are logged like arrays of the same element type.Numberand other non-integral number element types are logged as double arrays.Short,Integer, andLongelement types are logged as integer arrays.StructSerializableelement types are logged with their public staticstructserializer. Other element types fall back to string arrays usingObject.toString().- Parameters:
name- the namevalue- the valueelementType- the collection element type
-
log
Logs a collection of objects with a Struct serializer.- Type Parameters:
T- data type- Parameters:
name- the namevalue- the valuestruct- struct serializer for the value type or one of its supertypes
-
log
Logs a boolean.- Parameters:
name- the namevalue- the value
-
log
-
log
Logs a short.- Parameters:
name- the namevalue- the value
-
log
-
log
-
log
Logs a float.- Parameters:
name- the namevalue- the value
-
log
Logs a double.- Parameters:
name- the namevalue- the value
-
log
-
log
-
log
Logs a boolean array.- Parameters:
name- the namevalue- the value
-
log
Logs a short array.- Parameters:
name- the namevalue- the value
-
log
Logs an int array.- Parameters:
name- the namevalue- the value
-
log
Logs a long array.- Parameters:
name- the namevalue- the value
-
log
Logs a float array.- Parameters:
name- the namevalue- the value
-
log
Logs a double array.- Parameters:
name- the namevalue- the value
-
log
-
log
Logs a raw value (byte array).- Parameters:
name- the namevalue- the value
-
log
-