TelemetryTable

A namespace of logged values: a path like /Drive, whose topics are /Drive/leftVelocity and so on, and whose children are tables like /Drive/Odometry.

A table caches the tables and handles it hands out by name, but each lookup still splits the name and hits a map, so hold on to a table or a topic in a field rather than looking it up every loop. The fastest way to log is a typed handle:

private val table = Telemetry.table("Shooter")
private val velocity = table.doubleTopic("wheelVelocity")
private val ready = table.booleanTopic("ready")

fun periodic() {
velocity.set(encoder.velocity)
ready.set(atSpeed())
}

log is the shorter way, which looks the handle up each time: table.log("wheelVelocity", encoder.velocity).

Names

A name with slashes, like a/b, is the same as asking for the table a and then the name b. Leading and doubled slashes are ignored, and so are all the slashes of a table name. A topic name that ends in a slash has no name, so it warns and drops the value.

Types

A path holds one type for as long as a backend is registered. Logging a different type to a path that a backend already has warns, and the value doesn't reach that backend. Telemetry never throws into the code that calls it. It reports what it can't log through the registry's warning handler.

Because the rule belongs to the backend, not the program, each OpMode starts clean: its backends are new, so it can give a path a type that an earlier OpMode gave it a different one for.

Struct values

Any other object is logged as a struct, with its schema reflected from its class by the registry's TelemetryRegistry.structs. See dev.nextftc.util.struct.StructSchemaRegistry for what is supported, and use topic with a hand-written StructSchema for a class that can't be reflected or to log faster.

A list can't be logged with log, because its element type is erased. Use arrayTopic, or the logArray extension.

A table may be used from any thread.

Properties

Link copied to clipboard

The path of this table, such as /Drive, or empty for the root

Functions

Link copied to clipboard
fun <T : Any> arrayTopic(name: String, schema: StructSchema<T>): Topic<List<T>>

Returns the handle for the topic name that holds arrays of structs of schema.

fun <T : Any> arrayTopic(name: String, type: Class<T>): Topic<List<T>>

Returns the handle for the topic name that holds arrays of structs of type.

fun <T : Any> arrayTopic(name: String, type: KClass<T>): Topic<List<T>>

Returns the handle for the topic name that holds arrays of structs of type. See topic for how the schema is found.

Link copied to clipboard
inline fun <T : Any> TelemetryTable.arrayTopic(name: String): Topic<List<T>>

Returns the handle for the topic name that holds arrays of structs of T.

Link copied to clipboard

Returns the handle for the topic name that holds arrays of booleans.

Link copied to clipboard

Returns the handle for the boolean topic name.

Link copied to clipboard

Returns the handle for the topic name that holds arrays of doubles.

Link copied to clipboard

Returns the handle for the double topic name.

Link copied to clipboard

Returns the handle for the topic name that holds arrays of floats.

Link copied to clipboard

Returns the handle for the float topic name.

Link copied to clipboard

Returns the handle for the topic name that holds arrays of integers.

Link copied to clipboard

Returns the handle for the integer topic name, for values that fit in an Int.

Link copied to clipboard
fun log(name: String, value: Any)

Logs value at name, choosing how from what it is.

fun log(name: String, value: Boolean)

Logs value to the boolean topic name.

fun log(name: String, value: BooleanArray)

Logs value to the topic name that holds arrays of booleans.

fun log(name: String, value: Double)

Logs value to the double topic name.

fun log(name: String, value: DoubleArray)

Logs value to the topic name that holds arrays of doubles.

fun log(name: String, value: Float)

Logs value to the float topic name.

fun log(name: String, value: FloatArray)

Logs value to the topic name that holds arrays of floats.

fun log(name: String, value: Int)
fun log(name: String, value: Long)

Logs value to the integer topic name.

fun log(name: String, value: IntArray)
fun log(name: String, value: LongArray)

Logs value to the topic name that holds arrays of integers.

fun log(name: String, value: String)

Logs value to the string topic name.

Link copied to clipboard
inline fun <T : Any> TelemetryTable.logArray(name: String, values: List<T>)

Logs values, a list of structs of T, to the topic name.

Link copied to clipboard

Returns the handle for the topic name that holds arrays of integers.

Link copied to clipboard

Returns the handle for the integer topic name.

Link copied to clipboard

Returns the handle for the topic name that holds arrays of strings.

Link copied to clipboard

Returns the handle for the string topic name.

Link copied to clipboard

Returns the child table name, creating it if needed.

Link copied to clipboard
fun <T : Any> topic(name: String, schema: StructSchema<T>): Topic<T>

Returns the handle for the struct topic name, which holds values of schema.

fun <T : Any> topic(name: String, type: Class<T>): Topic<T>
fun <T : Any> topic(name: String, type: KClass<T>): Topic<T>

Returns the handle for the struct topic name, which holds values of type.

Link copied to clipboard
inline fun <T : Any> TelemetryTable.topic(name: String): Topic<T>

Returns the handle for the struct topic name, which holds values of T.

Link copied to clipboard
open override fun toString(): String