Reputation: 119
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?
Upvotes: 0
Views: 1848
Reputation: 164
I think this could work for you. (assuming you are not using ROS2)
<?xml version="1.0"?>
<launch>
<node pkg="pkg1" type="node1.py" name="node1">
</node>
<node pkg="pkg2" type="node2.py" name="node2">
</node>
<node pkg="pkg3" type="node3.py" name="node3">
</node>
</launch>
If I remember correctly, the launch file can start any node, independent of packages. I usually create an additional package (and name it for example startup
) and use it simply for my launch files.
This reference should have everything documented that you need. You'll find the details to launch a node here.
Upvotes: 1
Reputation: 4803
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>
Upvotes: 1