If you followed me in the last laboratory lesson where we visualize the Erdf model of the robot in Arvis
and if like me, you are a lazy person, you are probably wondering, isn't there a better and faster
way to visualize a model in RVs without the need of opening all those terminals and execute all those
commands?
Fortunately, the answer is yes and is called launch files in Ros two.
Lunch files is a tool available in Ros2 that allows you to create a list of functionalities and to start
all of them with a single command.
As we have noticed at this point of the course to start different functionalities of our application,
we need to execute several commands in separate terminals.
For example, we had to start a terminal to run the robot estate publisher node, which reads the Urdf
model of the robot and publish it within our ros2 topic.
Then we also had to start the joint state publisher note to move the robots joint and also the RVs to
Node to visualize all of these components in the RVs graphical interface.
For more complex application.
It may also be needed to open additional terminals to configure parameters or to view their content.
Obviously, as the complexity of our robotic application increases the number of nodes to start and
the number of parameters to configure or to change during the execution of the application also increases
exponentially.
As a result, the number of operations and the number of terminals that we need to open to configure
a start, all of those nodes also increases.
To facilitate these management roles provides launch files which are files that can be written in Python,
XML or Yaml and contain a list of operations.
So a set of instructions, a list of instructions to be executed in order to start a certain application
or a certain functionality.
Through a simple command, the Ros two Launch command.
It is possible to automatically execute a list of operations.
For example, you can list a series of nodes to start and it is also possible to declare dependencies
between them.
For example, starting one node before another one or even waiting for one to finish its execution before
starting another and so on.
It is also possible to configure multiple parameters for different nodes at the same time so that they
are correctly configured according to our needs when they start.
Furthermore, it is also possible to start application and processes that are also external to Ros two
and can start other functionalities to interact with the robot.
These components are the building blocks of a launch file.
And so they describe its functionality and indicate the list of operations that the launch file will
start and manage.
Since a single large file can contain an arbitrarily large list of instructions to start, one might
be thinking of listing all the instructions and therefore starting all the nodes of the robot's functionalities
inside a single launch file.
This approach violates one of the fundamental principles of the launch file, which is composition and
reusability.
A launch file should contain a list of operations that have a logical and functional relationship with
each other.
This way different launch files can be created one for each application and functionality of the robot.
All of these lounge files can then be stacked together by another launch file that is responsible for
starting all the robots functionalities.
Considering the dependencies and the priorities of each functionality.
Throughout the course, we are going to use Python for creating lunch files, which is the default approach
used in Ros two, although XML or Yaml can also be used since they are not really programming languages,
they offer limited functionalities and cannot be used to create advanced and complex robotics application.
Creating a file in Ros2 is related to creating a list of operations that needs to be executed in order
to start a certain application.
So this list is contained within a launch description.
Primarily to add this list and to start any application program or process or instruction.
We will use two libraries that are launch and launch.
Ross.
Since these two libraries contain many modules and many functionalities.
As a general guideline, you can think of the launch library as containing the functionalities for managing
and configuring the launch file itself and its interface with the outside world, such as, for example,
the interface offered to the user or also to other launch files that are using it, as well as its interface
with the operating system and other applications.
Instead, the launch underscore Ross Library contains functionalities that are specific to Ross two,
such as managing Ross two nodes and parameters.
In the next laboratory lesson, we will see how to use this tool to reproduce all the steps required
to visualize the Erdf model of the robot in.
But this time using only one terminal and only one command.