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

Create multiple instances of a process

asked 2022-03-14 10:22:05 -0500

S4JJ4D gravatar image

ROS2 newbie here. I use the following command in terminal to run a turtlesim_node:

ros2 run turtlesim turtlesim_node

A node named /turtlesim starts running along with a host of topics and services whose names start with /turtle1/....

To create another instance of this node, I am using

ros2 run turtlesim turtlesim_node --ros-args -r __node:=turtlesim2

A node named /turtlesim2 starts running. But the problem is that no new set of topics/services are created along with this node. It is still operating/communicating with topics/services named /turtle1/.... My intention is to create a completely separate node with its own topics/services. Following the instructions in [1], here's the final try:

ros2 run turtlesim turtlesim_node --ros-args -r __node:=turtlesim2 -r /turtle1/**:=/turtle2/\1

hoping to map all /turtle1/... names to /turtle2/... names so that I can have a complete clone to the original process. But I get the following error:

terminate called after throwing an instance of 'rclcpp::exceptions::RCLInvalidROSArgsError' what():  failed to initialize rcl: Couldn't parse remap rule: '-r /turtle1/**:=/t1/1'. Error: Wildcard '**' is not implemented, at /tmp/binarydeb/ros-galactic-rcl-3.1.2/src/rcl/arguments.c:1167, at /tmp/binarydeb/ros-galactic-rcl-3.1.2/src/rcl/arguments.c:371

what's the issue? Is this the standard procedure to create an identical process from a package executable?

using: x86_64 GNU/Linux, ubuntu 20.04, ros2 galactic

[1] [StaticRemapping](https://design.ros2....

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-03-14 13:17:41 -0500

gy gravatar image

updated 2022-03-15 03:06:42 -0500

gvdhoorn gravatar image

Have you tried running with a specified namespace? This should push all of your topics/services into the respective namespace:

-r __ns:=<new node namespace>

https://docs.ros.org/en/galactic/How-...

edit flag offensive delete link more

Comments

I did try this, but it unnecessarily changes the structure of the graph. It seems to me that a lot of flexibility in name manipulation is lost when wildcard ** remapping syntax is not working. Although the syntax is marked as "Supporting" in ROS2 documentation, it is not working in my case. Nevertheless, changing the namespace grouped the node and all its related topics/services together so I could produce multiple instances in the same manner by giving each, a different namespace.

Thank you.

S4JJ4D gravatar image S4JJ4D  ( 2022-03-15 10:03:20 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-03-14 10:08:54 -0500

Seen: 256 times

Last updated: Mar 15 '22