ROS2 C based dynamic typesupport example?

asked 2021-02-20 09:12:30 -0500

Jan Wielemaker gravatar image

updated 2021-02-21 08:21:24 -0500

I'm pretty new to ROS and still a bit overwhelmed :) I'm studying the options for a successor of rosprolog for ros2. Based on the rclpy code is wasn't that hard to use rcl and rmw and get the library initialized and a node created. Somewhat harder was to subscribe to a topic. Eventually I managed to figure out I could dynamically load the C based .so file that defines the messages for a package, find the right function and call it to get the rosidl_message_type_support_t instance. So far so good.

The next challenge is to actually assemble or decompose a message. I think the rosidl API dealing with dynamic message (de) serialization is the most appropriate approach. As a dynamically typed language the extra overhead of walking over the types using runtime switches is probably smaller than the cost to convert the raw byte data into the format using inside Prolog anyway.

So, I'm trying to get my head around using dynamic type support to walk over a message and create a message. I have a hard time figuring out where to start though :( It seems hard to find an example :(

Can anyone point at an example or describe the general idea to walk over a message?

Thanks --- Jan

edit retag flag offensive close merge delete

Comments

1

This is a good ROS Answers question, but seeing as there have been / still are some discussions about client library development in ROS 2 on ROS Discourse, you may want to take a look there as well and see whether you could draw some attention to your question here by posting in those threads.

Be sure to mention you've already posted on ROS Answers though, otherwise you may run the risk of being "reprimanded".

gvdhoorn gravatar image gvdhoorn  ( 2021-02-21 06:25:04 -0500 )edit

Post on ROS Discourse: ROS2 C based dynamic typesupport example?.

@Jan Wielemaker: if you post somewhere else, please always post a comment with the link to that "somewhere else" here, so we can keep things connected.

gvdhoorn gravatar image gvdhoorn  ( 2021-02-22 03:23:39 -0500 )edit

I planned to. As I don't have enough brownie points to to avoid the moderator I didn't have a link immediately and forgot after. Sorry. Thanks for linking the two.

Jan Wielemaker gravatar image Jan Wielemaker  ( 2021-02-22 03:28:40 -0500 )edit

I don't see any post by you held up in moderation?

gvdhoorn gravatar image gvdhoorn  ( 2021-02-22 03:32:50 -0500 )edit