Summary
In this chapter, you worked on ROS 2 launch files. Launch files allow you to properly scale your application with multiple nodes, parameters, and sets of configuration.
You can write a launch file in Python, XML, or YAML. Here, you discovered the Python and XML syntax and saw that XML is probably the best choice by default. The syntax is much easier, and the code is much shorter. If you ever need to combine XML and Python launch files, you can do so by including a launch file in another one.
The best practice is to set up a dedicated package for launch files and YAML files. You can name the package using the _bringup
suffix. Launch files will be installed in a launch
folder, and YAML param files in a config
folder.
If you correctly understand how to start nodes with the ros2 run command
, then doing so in a launch file is pretty straightforward: you just need to provide the package and executable name for each node. The only thing to learn is the XML or Python syntax...