Launching Other Launch Files¶
Think back to the move_circle.py node that you created in Week 2. We need a simulation of our robot active in order to run this, which we can enable with the following command (which you should be very familiar with by now):
Suppose you wanted to save yourself some work and launch both the simulation and the move_circle.py node at the same time...
-
Firstly, return to your
week2_navigationpackage and create alaunchdirectory (if you haven't done so previously): -
Then create a launch file. You could call this whatever you want, but for the purposes of this example we'll create one called
circle.launch: -
Inside this file add the following:
<launch> <include file="$(find turtlebot3_gazebo)/launch/turtlebot3_empty_world.launch" /> <node pkg="week2_navigation" type="move_circle.py" name="circle_node" output="screen" /> </launch>The
<node>tag should already be familiar to you, but the<include>tag before it might not be...This is what we use to launch other launch files. Here, we are locating the
turtlebot3_gazebopackage (usingfind), and asking for theturtlebot3_empty_world.launchfile to be executed. -
From the command-line, execute your newly created launch file as follows:
The TurtleBot3 Waffle will be launched in the "empty world" simulation, and the robot will start moving in a circle straight away!