Search code examples
ros

Creating a roslaunch file that includes nodes from several packages


In my Ros Workspace (ws), there are 3 packages in src folder. And in each package, there is a node (contained in scripts folder) which is written using python. I need to write a roslaunch file that runs all 3 nodes at once.

Folder structure

ws
  -src
    -pkg1
       -scripts/node1.py
    -pkg2
       -scripts/node2.py
    -pkg3
       -scripts/node3.py
  -launch *#I want to keep the launch file in here.*

Can someone help me or point me out on how to write the launch file combining multiple packages?


Solution

  • Roslaunch makes this fairly easy as it includes a tag for what package to launch a node from. Take the following example:

    <launch>
        <node pkg="pkg1" type="node1.py" name="node1">
            <param name="some_param1" value="value1">
        </node>
        <node pkg="pkg2" type="node2.py" name="node2">
            <param name="some_param2" value="value2">
        </node>
    </launch>