ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I see that the java case requires patching the CMakeLists.txt and package.xml of the rosidl_default_generators package. Is this mandatory? I.e., cannot one add a new generator in a new package without having to patch other people's packages?

That should not be necessary anymore. I don't know which exact change you are referring to but I assume adding the new generator as a dependency? With REP 149 group dependencies were added and those are now being used by the message generators. Using those it should be possible to create a new package containing a message generator and declare the group membership in that package in order to be picked up during the build and being processed before message packages.

In general whenever a message package calls rosidl_generate_interfaces all registered message generators are being run. That happens by including the CMake file each message generator has registered as an extension, e.g. https://github.com/ros2/rosidl/blob/cfedd4afb8383965590f3234c169c6839f16468c/rosidl_generator_cpp/cmake/register_cpp.cmake#L20

Each message generator decides how it wants to perform the code generation. Most of them are invoking Python to generate files based on templates and the msg/srv files passed. The CMake code for it is pretty lengthy since it also needs to track what files are expected to be generated and what files are involved in that (in order to regenerate files if and only if any of the involved files changes). Some generators also additionally run code linter on the generated code. E.g. https://github.com/ros2/rosidl/blob/master/rosidl_generator_cpp/cmake/rosidl_generator_cpp_generate_interfaces.cmake

I hope this give a high level overview of the process. Please feel free to add more concrete questions.