Robotics StackExchange | Archived questions

How to pass arguments (incl. rosparams, remapppings and setting node name) to ros2 components?

In response to this questions I had a few follow up questions.

I noticed that I couldn't remap topic names when trying the ROS2 composition tutorial. I wanted to remap the topic name of composition::Listener from chatter to chatter2, which seems impossible. This seems like a huge loss of flexibility to me (compared to ROS1). ROS provides setting namespaces and remappings at runtime to avoid recompiling of software, right?

As @wjwwood suggested here ros2 param solution could work, but I have some doubts:

I also noticed that setting argv is possible when using the manual_composition example, e.g.:

ros2 run composition manual_composition talker:__node:=my_talker my_talker:chatter:=chatter2 listener:chatter:=chatter2

So wouldn't it make sense to expose a similar functionality to the api_composition_cli node and/or composition/LoadNode service?

Asked by koenlek on 2019-01-02 16:42:11 UTC

Comments

Answers

Perhaps, you could try using the following functions from rcl/remap.h: rcl_remap_node_name rcl_remap_topic_name

Asked by divserge on 2019-02-16 16:27:59 UTC

Comments