TelemetryLoggable
An object that knows how to publish itself into a TelemetryTable.
Implement this for a type that is several values. Call sites log one object, and the type decides what appears under it:
class DriveState(val left: Double, val right: Double, val pose: Pose2d) : TelemetryLoggable {
override fun logTo(table: TelemetryTable) {
table.log("left", left)
table.log("right", right)
table.log("pose", pose)
}
}
Telemetry.log("drive", driveState) // lands under /drive/left, /drive/right, and /drive/poseContent copied to clipboard
Logging a loggable is a series of separate writes, not one atomic snapshot. A reader can see some fields from this loop and some from the last. If the fields must agree, log a struct instead.
Functions
Link copied to clipboard
Writes this object's values into table, which is the child table named by the caller.