ros2_rust icon indicating copy to clipboard operation
ros2_rust copied to clipboard

does ros2_rust support autogeneration of code from .idl and .msg files, is there any example implementation to autogenerate rust nodes from .idl/.msg files?

Open vignesh-tw opened this issue 2 years ago • 1 comments

vignesh-tw avatar Nov 10 '23 05:11 vignesh-tw

We can generate rust code for idl and msg files thanks to the rosidl_generator_rs and rosidl_runtime_rs packages in this repo.

In the rclrs_example_msgs package, we define a few .msg files and then we consume them in message_demo example. There is nothing special about the rclrs_example_msgs package, the "magic" is in message_demo's package.xml where we specify our dependency on the rosidl_runtime_rs package.

As for the second part of your question, there is no way to generate nodes from just .idl/.msg files. To quote the ROS 2 docs

A node is a fundamental ROS 2 element that serves a single, modular purpose in a robotics system.

So having codegen for types defined in .idl/.msg files is different from automatically generating a node. You'll still need to write code that uses your auto-generated types.

maspe36 avatar Nov 11 '23 19:11 maspe36