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

Parallel execution of same ROS nodes

asked 2018-05-12 18:14:16 -0500

touhid gravatar image

Hi all,

What I am trying to achieve is:

I have one ROS node which is publishing one info on a topic and another subscriber node subscribed on that topic to process the info. I am launching both of them from a launch file. Now I want to run several instances of this launch file, for example 5 in parallel, where each instance will be independent i.e., the publisher or subscriber of one instance will not interfere the other. What do I mean is, in case of parallel execution, same topic will be used along these instances, so I am worried that this may create problems. So, If these instances are independent then there should not be any problem regarding publishing and subscribing on a same topic.

So, my question is: Does ROS permits this parallel execution of several instances of same launch file which describes several publisher and subscriber nodes? I have tried to google to find some information regarding this but I wasn't lucky. Any suggestion regarding this will be really helpful.


edit retag flag offensive close merge delete


I'm not sure that I understand your question. Are you asking if you can run the same node multiple times at the same time?

jayess gravatar image jayess  ( 2018-05-12 19:06:20 -0500 )edit

Yes, but its like a group of nodes. i.e. Launch file has multiple nodes. I want to launch several instances of this launch file where each instance is independent i.e., the nodes described in one instance of launch file should not interfere with the nodes of other instances.

touhid gravatar image touhid  ( 2018-05-12 19:20:39 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-05-13 00:43:10 -0500

mohsen gravatar image

updated 2018-05-13 01:43:18 -0500

You can configure the launch file so that the same group of nodes are put in different namespaces.
For example:


  <group ns="group1">  
        <node name="pub" pkg="myPkg" type="pub_node"/>  
        <node name="sub" pkg="myPkg" type="sub_node"/>  

  <group ns="group2">  
        <node name="pub" pkg="myPkg" type="pub_node"/>  
        <node name="sub" pkg="myPkg" type="sub_node"/>  


Note that the full names for the topics (and nodes) will be, for instance, /group1/sub_in or /group2/pub_node. You might want to remap the names outside the namespace accordingly.

edit flag offensive delete link more


Hi Mohsen Thanks for your answer. It worked. One of my thinking was that, the parallel node execution should not interfere each other. But, It looks like it does. So, I had to do lots of changing in the code.

touhid gravatar image touhid  ( 2018-05-15 19:25:15 -0500 )edit

Question Tools



Asked: 2018-05-12 18:14:16 -0500

Seen: 1,639 times

Last updated: May 13 '18