Skip to content

Expanded VLA and Optional support in photon-serde#2492

Open
Bobcat66 wants to merge 46 commits into
PhotonVision:mainfrom
Bobcat66:squash-photon-serde-enhancements
Open

Expanded VLA and Optional support in photon-serde#2492
Bobcat66 wants to merge 46 commits into
PhotonVision:mainfrom
Bobcat66:squash-photon-serde-enhancements

Conversation

@Bobcat66

@Bobcat66 Bobcat66 commented May 16, 2026

Copy link
Copy Markdown
Contributor

Description

Adds support for Optional WPI structs and VLAs of WPI structs in photon-serde, as well as optional intrinsic types and VLAs of intrinsic types. Also adds an int8 datatype, corresponding to Byte in java and int8_t in C++.

This PR also partially automates photon-serde testing, allowing for the creation of "test messages", which will have a corresponding class automatically generated alongside the serde code, to allow for quick testing and prototyping of new photon-serde features

This has been tested in Java, C++ tests and Python tests are WIP

I ran into a few issues with photonserde while trying to send an optional Transform3ds in #2440 and VLAs of Integers in #2477. #2477 ended up being irrelevant because of #2103, but i'm worried similar issues could come up in the future, especially if GTSAM ends up running on a coprocessor

Meta

Merge checklist:

  • Pull Request title is short, imperative summary of proposed changes
  • The description documents the what and why, including events that led to this PR
  • If this PR changes behavior or adds a feature, user documentation is updated
  • If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly
  • If this PR touches configuration, this is backwards compatible with all settings going back to the previous seasons's last release (seasons end after champs ends)
  • If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated
  • If this PR addresses a bug, a regression test for it is added
  • If this PR adds a dependency, the license has been checked for compatibility and steps taken to follow it

Bobcat66 added 9 commits May 13, 2026 15:30
commit 0a27b16
Author: Jesse Kane <jessekane66@gmail.com>
Date:   Wed May 13 15:04:11 2026 -0400

    linting

commit 78d1c5e
Author: Jesse Kane <jessekane66@gmail.com>
Date:   Mon May 11 18:54:51 2026 -0400

    fixed ambiguous cases

commit f4e64ef
Author: Jesse Kane <jessekane66@gmail.com>
Date:   Sat May 9 16:50:51 2026 -0400

    stuff
@github-actions github-actions Bot added the photonlib Things related to the PhotonVision library label May 16, 2026
@Bobcat66 Bobcat66 marked this pull request as ready for review May 19, 2026 17:30
@Bobcat66 Bobcat66 requested a review from a team as a code owner May 19, 2026 17:30
Comment thread photon-serde/templates/ThingTestClass.java.jinja
Comment on lines +279 to +285
if (data.size() > 0) {
encoder =
(packet, value) -> {
;
};
} else {
encoder = data.get(0).getSerde()::pack;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Help me understand the logic here? If data is empty, we call data.get(0)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's actually a typo lol, its meant to be if (data.size() < 1) not if (data.size() > 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. Would be good to get some unit tests of Packet -- our current tests actually aren't very useful and didn't catch this guy

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should that be its own issue or can I just tack that onto this PR?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're adding new code I'd like our unit tests to hit the new codepaths

@Bobcat66 Bobcat66 requested a review from a team as a code owner May 27, 2026 14:38
@github-actions github-actions Bot added documentation Anything relating to https://docs.photonvision.org frontend Having to do with PhotonClient and its related items backend Things relating to photon-core and photon-server and removed documentation Anything relating to https://docs.photonvision.org frontend Having to do with PhotonClient and its related items backend Things relating to photon-core and photon-server labels May 27, 2026
@Bobcat66 Bobcat66 force-pushed the squash-photon-serde-enhancements branch from 50829f0 to cb66fe9 Compare May 27, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

photonlib Things related to the PhotonVision library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants