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

So is it possible to have to compile two different classes that both inherit from rclcpp::Node in one executable or does this break ROS 2 design rules?

You could create each node in separate files and use them in one executable using node composition. Please take a look at this example https://github.com/ros2/demos/blob/master/composition/src/manual_composition.cpp.

You can read more about composition here: - https://docs.ros.org/en/rolling/Concepts/About-Composition.html - https://docs.ros.org/en/rolling/Tutorials/Composition.html - https://roscon.ros.org/2019/talks/roscon2019_composablenodes.pdf