-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Fixed Sized Arrays #150
Conversation
@ssnover Do you have any good ideas on how we should handle this situtation?
Am I just missing an obvious solve here. |
We have at least one instance showing in the codegen for a 36 member array, so we probably ought to at least support that as a basic ROS message. Only alternative I can think of is to represent with a tuple of Vec and the fixed size and then define our own serialization and deserialization for serde_rosmsg? |
Actually, how does serde_rosmsg handle |
I have a little side test setup in my fork of serde_rosmsg, from when the bug was originally reported, where I'm deserializing a NavSatFix.msg with the library. NavSatFix has an [f64; 9] in it. For Box<[f64]> serde_rosmsg spat out an underflow error at runtime. So don't see a good path there... |
Has lead me to: https://crates.io/crates/serde-big-array Which I'm going to play with and see if it can solve this problem... See root serde issue here: serde-rs/serde#1937 |
So it looks like a combination of some fuckery with smart_default's _code directive and this serde-big-array crate I may have gotten a working solution. Biggest problem I see is 1) the code is super messy and could use some unit tests, and 2) we're leaking yet another crate dependency through the codegen interface in not a great way... I'd love your eyes on this @ssnover |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thanks for taking the time to figure out the attribute macro magic required to get this functioning and adding tests.
I pointed out the current CI failures in comments.
…, removed unused import
Actions completed, not sure how to "say done"
Description
ROS1 serialization with serde_rosmsg requires that fixed sized arrays be represented not as Vec<> but as [; N]. The two are sent over the wire differently. Most of the support for this was already plumbed through, so this just closed the loop at the end, but is hitting the "const generic" barrier.
Fixes
Closes: #148
Checklist