Skip to content

FR: struct field with array type #272

Description

@truher

There is apparently support [1] in the WPI Struct encoding for fixed-length array fields, and there is an example implementation, VectorStruct [2]. I couldn't find a way to make this work with make_wpistruct, e.g. using "list" or "tuple". This isn't an urgent problem: the workaround for my case is many primitive fields, but it would be cleaner if it were an array.

So the FR is to add support for array fields to make_wpistruct. A good test case would be the python implementation of VectorStruct.

Just to be clear, I'm talking about a definition like this:

@wpistruct.make_wpistruct 
@dataclasses.dataclass
class Payload:
    foo: tuple[float, float, float]

[1] https://github.com/wpilibsuite/allwpilib/blob/main/wpiutil/doc/struct.adoc

[2] https://github.com/wpilibsuite/allwpilib/blob/a99c0903320f7e819b7d48ffc1b8b7145c663bc6/wpimath/src/main/java/org/wpilib/math/linalg/struct/VectorStruct.java#L45

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions