FateTable

class FateTable

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

Tables are cheap and cache what they need, so hold one in a field rather than looking it up every loop:

private val table = Fate.table("Shooter")

fun periodic() {
table.log("wheelVelocity", encoder.velocity)
table.log("ready", atSpeed())
}

A path holds one type of value for as long as the program runs. Logging a different type to it warns and skips the value. Telemetry never throws into the code that calls it. It reports a value it can't log through the registry's warning handler.

A table may be used from any thread. Concurrent calls to one path are safe but land in no guaranteed order. Telemetry does not guard the objects you pass in, so don't mutate a value while it is being logged.

The schema of a value comes from its type, the same way gay.zharel.fateweaver.log.FateLogWriter infers it. In Kotlin, log is a reified extension, so a parameterized value such as a Map<String, Double> keeps its type arguments. Java sees logErased as log. It only has the runtime class to go on, so it rejects maps and collections. Pass a schema to log one from Java.

Properties

Link copied to clipboard

The slash-separated path of this table, empty for the root.

Functions

Link copied to clipboard
fun <T : Any> log(name: String, value: T, schema: FateSchema<T>)

Logs value at name using schema instead of inferring one.

Link copied to clipboard
inline fun <T : Any> FateTable.log(name: String, value: T)

Logs value at name, inferring its schema from T's static type, type arguments included.

Link copied to clipboard
@JvmName(name = "log")
fun logErased(name: String, value: Any)

Logs value at name in this table, inferring its schema from its runtime class.

Link copied to clipboard
fun logTyped(name: String, value: Any, type: KType)

Logs value at name in this table, inferring its schema from the fully resolved type rather than from value's erased runtime class.

Link copied to clipboard
fun table(name: String): FateTable

Returns the child table name, creating it if needed. A name with slashes, like a/b, is the same as asking for a and then b.

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