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

Revision history [back]

click to hide/show revision 1
initial version

You could use eval (as of Kinetic) to create a recursive launchfile:

<launch> 

   <!-- start node -->
   <arg name="nr" default="1"/> 
   <group ns="$(eval 'turtle' + str(arg('nr')))">
      <node name="turtle" pkg="turtlesim" type="turtlesim_node"/>
   </group>

   <!-- recursively start new node -->
   <include file="$(find your_package)/launch/this_launch_file.launch" if="$(eval arg('nr') - 1 > 0)">
       <arg name="nr" value="$(eval arg('nr') - 1)"/>
   </include>

</launch>

As of Lunar you could also use $(dirname) instead of $(find your_package)/launch.