sequenceplanner/r2r

Handling raw messages with `rcl_take_serialized_message`

mchhoy opened this issue · 1 comments

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!

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().