Launch files
Let’s finish this list of ROS 2 concepts with launch files.
A launch file will allow you to start several nodes and parameters from just one file, which means that you can start your entire application with just one command line.
In Chapter 9, you will learn how to write your own launch file, but for now, let’s just start a few to see what they do.
Starting a launch file
To start a single node in the terminal, you have seen the ros2 run
command. For launch files, we will use ros2 launch <
package_name> <launch_file>
.
Stop all running nodes, and let’s start the talker_listener
launch file from the demo_nodes_cpp
package. In Terminal 1, run the following command:
$ ros2 launch demo_nodes_cpp talker_listener_launch.py [INFO] [launch]: All log files can be found below /home/ed/.ros/log/2024-03-14-16-09-27-384050-ed-vm-2867 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [talker-1]: process started with pid...