StructArrayLogEntry

class wpilog.StructArrayLogEntry(*args, **kwargs)

Bases: DataLogEntry

Log raw struct serializable array of objects.

Overloaded function.

  1. __init__(self: wpilog._wpilog.StructArrayLogEntry, log: wpilog._wpilog.DataLog, name: str, type: type, timestamp: typing.SupportsInt | typing.SupportsIndex = 0) -> None

  2. __init__(self: wpilog._wpilog.StructArrayLogEntry, log: wpilog._wpilog.DataLog, name: str, metadata: str, type: type, timestamp: typing.SupportsInt | typing.SupportsIndex = 0) -> None

append(data: List[object], timestamp: SupportsInt | SupportsIndex = 0) None

Appends a record to the log.

Parameters:
  • data – Data to record

  • timestamp – Time stamp (may be 0 to indicate now)

getLastValue() list[object] | None

Gets the last value.

Note

The last value is local to this class instance and updated only with Update(), not Append().

Returns:

Last value (empty if no last value)

hasLastValue() bool

Gets whether there is a last value.

Note

The last value is local to this class instance and updated only with Update(), not Append().

Returns:

True if last value exists, false otherwise.

update(data: List[object], timestamp: SupportsInt | SupportsIndex = 0) None

Updates the last value and appends a record to the log if it has changed.

Note

The last value is local to this class instance; using Update() with two instances pointing to the same underlying log entry name will likely result in unexpected results.

Parameters:
  • data – Data to record

  • timestamp – Time stamp (may be 0 to indicate now)