Ask Your Question
0

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.

Thanks

edit retag flag offensive close merge delete

Comments

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 imagejayess ( 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 imagetouhid ( 2018-05-12 19:20:39 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

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:

<launch>

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

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

</launch>

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

Comments

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 imagetouhid ( 2018-05-15 19:25:15 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 181 times

Last updated: May 13 '18