The launch file

The launch file is a useful feature in ROS for launching more than one node. In these sections, we have created nodes and we have been executing them in different shells. Imagine working with 20 nodes and the nightmare of executing each one in a shell!

With the launch file, we can do it in the same shell by launching a configuration file with the extension .launch.

To practise using this utility, we are going to create a new folder in our package as follows:

    $ roscd chapter2_tutorials/
    $ mkdir launch
    $ cd launch
    $ vim chapter2.launch  

Now put the following code inside the chapter2.launch file:

<?xml version="1.0"?> 
<launch> 
  <node name ="example1_a" pkg="chapter2_tutorials"  type="example1_a"/> <node name ="example1_b" pkg="chapter2_tutorials" ...

Get ROS Programming: Building Powerful Robots now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.