Skip to content
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

Handling raw messages with rcl_take_serialized_message #72

Closed
mchhoy opened this issue Dec 12, 2023 · 1 comment · Fixed by #73
Closed

Handling raw messages with rcl_take_serialized_message #72

mchhoy opened this issue Dec 12, 2023 · 1 comment · Fixed by #73

Comments

@mchhoy
Copy link
Contributor

mchhoy commented Dec 12, 2023

Hi there,

I have a use case where I would prefer to not deserialize messages and get a Vec<u8> somehow

It seems the libraries in other languages use the rcl function rcl_take_serialized_message instead of rcl_take

https://docs.ros2.org/bouncy/api/rcl/subscription_8h.html
RobotWebTools/rclnodejs#646

I'm happy to try and implement this for r2r, just wondering if there is any previous exploration to be aware of ..

Thanks!

@m-dahl
Copy link
Collaborator

m-dahl commented Dec 12, 2023

Hi,

Feel free to give it a go, I would be happy to have it. One nice usecase for this is that it would allow us to define message types as plain rust structs and then use cdr to deserialize the raw bytes.

I haven't tried rcl_take_serialized_message but at a glance it looks like it should just be a matter of adding another subscriber type that returns a stream of Vec and that calls rcl_take_serialized_message instead of rcl_take in handle_incoming().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants