StructSchema

interface StructSchema<T>(source)

Describes a WPILib struct: a fixed-size, packed, little-endian binary encoding of T together with a text schema that tells readers how to decode it.

This mirrors the shape of WPILib's Struct<T> interface, so a type that already has a WPILib struct can be adapted by forwarding its members. A struct is logged as a raw value whose type string is typeString, plus one schema entry per type (see schemaTopicName) holding schema.

AdvantageScope recognizes WPILib's built-in types such as Pose2d by typeName, so a schema meant to be drawn on a field view must use the same name and field layout as WPILib's.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The type string for a variable-length array of values, such as struct:Pose2d[].

Link copied to clipboard
open val nested: List<StructSchema<*>>

The struct types referenced directly by schema. Types nested deeper are found through these.

Link copied to clipboard
abstract val schema: String

The schema text, such as double x; double y. A field of another struct type refers to it by its typeName.

Link copied to clipboard

The name of the entry that holds schema, such as /.schema/struct:Pose2d.

Link copied to clipboard
abstract val size: Int

The size in bytes of one packed value. Every value of this type packs to exactly this many.

Link copied to clipboard
abstract val typeName: String

The struct's name without the struct: prefix, such as Pose2d.

Link copied to clipboard
open val typeString: String

The type string for a single value, struct: followed by typeName.

Functions

Link copied to clipboard
abstract fun pack(buffer: ByteBuffer, value: T)

Writes value into buffer at its current position, in exactly size bytes.