What is the correct way to use ROS2 composition and the class_loader for node classes which take arguments in the constructor?

asked 2017-05-14 05:31:29 -0500

edw gravatar image

updated 2017-05-14 09:09:36 -0500

Referring to the demos in the composition package in ROS2:



I believe that the examples all assume nodes which pass no arguments to the constructor. (This appears to be hard-coded in the class_loader code in ${ROS_WS}/install/include/class_loader/meta_object.h for example.)

As a simple example, if I want to extend the demo to use a single publisher and two subscribers, each with two different names, what is the preferred way to do this? Can the node name(and other variables) be set after construction? Can the class_loader be extended to take arguments?

In practice, I will have two or more nodes that are initialized using two different config files at runtime. The code for those nodes is identical and the node_name, initialization filenames etc. are set at runtime and create two unique nodes doing different things to the data that is subscribed to depending on the models that are read in at initialization.


edit retag flag offensive close merge delete