link composable node into standalone executable
I created a composable node that I want to link into a standalone executable for easier debugging with different parameters. The idea is that the library with the composable node is linked to an executable that behaves as if this would be a standalone node.
Using the launch system will involve other processes and makes debugging via gdb more difficult. Using the component manager for debugging a single component is quite tedious as you have to start the component manager with gdb and load the component manually.
One alternative is the dlopen_composition
executable from the composition
package, which dynamically loads the library with the component node, instantiates and runs it: ros2 run composition dlopen_composition <workspace>_ws/install/<package>/lib/lib<node>.so
.
However, the dlopen_composition
does not allow to pass configuration parameters like --ros-args --params-file
.
I found a node template node_main.cpp.in
at https://github.com/ros2/rclcpp/blob/f.... It looks as if this is doing the same as the dlopen_composition
just with a hardcoded library. Can this be used in some way to create a standalone executable from a single composable node?
I do not want to use the header to specifically link or compile the node's source code into the main executable. I strongly prefer to use the standard node factories for this.