WEBVTT

00:00.290 --> 00:07.370
If you followed me in the last laboratory lesson where we visualize the Erdf model of the robot in Arvis

00:07.370 --> 00:15.080
and if like me, you are a lazy person, you are probably wondering, isn't there a better and faster

00:15.080 --> 00:21.860
way to visualize a model in RVs without the need of opening all those terminals and execute all those

00:21.860 --> 00:22.610
commands?

00:23.200 --> 00:28.810
Fortunately, the answer is yes and is called launch files in Ros two.

00:29.990 --> 00:37.700
Lunch files is a tool available in Ros2 that allows you to create a list of functionalities and to start

00:37.700 --> 00:39.680
all of them with a single command.

00:40.480 --> 00:47.110
As we have noticed at this point of the course to start different functionalities of our application,

00:47.110 --> 00:51.160
we need to execute several commands in separate terminals.

00:51.430 --> 00:58.750
For example, we had to start a terminal to run the robot estate publisher node, which reads the Urdf

00:58.750 --> 01:03.580
model of the robot and publish it within our ros2 topic.

01:04.260 --> 01:12.120
Then we also had to start the joint state publisher note to move the robots joint and also the RVs to

01:12.120 --> 01:17.460
Node to visualize all of these components in the RVs graphical interface.

01:18.380 --> 01:20.210
For more complex application.

01:20.210 --> 01:27.350
It may also be needed to open additional terminals to configure parameters or to view their content.

01:28.010 --> 01:34.670
Obviously, as the complexity of our robotic application increases the number of nodes to start and

01:34.670 --> 01:40.790
the number of parameters to configure or to change during the execution of the application also increases

01:40.790 --> 01:41.840
exponentially.

01:42.170 --> 01:48.320
As a result, the number of operations and the number of terminals that we need to open to configure

01:48.320 --> 01:51.470
a start, all of those nodes also increases.

01:52.520 --> 02:00.590
To facilitate these management roles provides launch files which are files that can be written in Python,

02:00.710 --> 02:04.520
XML or Yaml and contain a list of operations.

02:04.520 --> 02:11.420
So a set of instructions, a list of instructions to be executed in order to start a certain application

02:11.420 --> 02:13.250
or a certain functionality.

02:14.110 --> 02:18.210
Through a simple command, the Ros two Launch command.

02:18.220 --> 02:22.960
It is possible to automatically execute a list of operations.

02:23.790 --> 02:30.330
For example, you can list a series of nodes to start and it is also possible to declare dependencies

02:30.330 --> 02:31.110
between them.

02:31.350 --> 02:39.180
For example, starting one node before another one or even waiting for one to finish its execution before

02:39.180 --> 02:41.160
starting another and so on.

02:41.460 --> 02:47.910
It is also possible to configure multiple parameters for different nodes at the same time so that they

02:47.910 --> 02:52.170
are correctly configured according to our needs when they start.

02:52.820 --> 02:59.660
Furthermore, it is also possible to start application and processes that are also external to Ros two

02:59.660 --> 03:03.890
and can start other functionalities to interact with the robot.

03:04.850 --> 03:08.930
These components are the building blocks of a launch file.

03:08.930 --> 03:15.260
And so they describe its functionality and indicate the list of operations that the launch file will

03:15.260 --> 03:16.730
start and manage.

03:17.540 --> 03:23.840
Since a single large file can contain an arbitrarily large list of instructions to start, one might

03:23.840 --> 03:30.110
be thinking of listing all the instructions and therefore starting all the nodes of the robot's functionalities

03:30.140 --> 03:31.910
inside a single launch file.

03:32.650 --> 03:39.490
This approach violates one of the fundamental principles of the launch file, which is composition and

03:39.490 --> 03:40.540
reusability.

03:41.080 --> 03:47.140
A launch file should contain a list of operations that have a logical and functional relationship with

03:47.140 --> 03:47.920
each other.

03:48.130 --> 03:54.760
This way different launch files can be created one for each application and functionality of the robot.

03:55.540 --> 04:02.380
All of these lounge files can then be stacked together by another launch file that is responsible for

04:02.380 --> 04:04.700
starting all the robots functionalities.

04:04.720 --> 04:09.070
Considering the dependencies and the priorities of each functionality.

04:10.110 --> 04:15.990
Throughout the course, we are going to use Python for creating lunch files, which is the default approach

04:15.990 --> 04:23.820
used in Ros two, although XML or Yaml can also be used since they are not really programming languages,

04:23.850 --> 04:30.990
they offer limited functionalities and cannot be used to create advanced and complex robotics application.

04:32.340 --> 04:40.470
Creating a file in Ros2 is related to creating a list of operations that needs to be executed in order

04:40.470 --> 04:42.630
to start a certain application.

04:42.630 --> 04:47.040
So this list is contained within a launch description.

04:48.100 --> 04:54.700
Primarily to add this list and to start any application program or process or instruction.

04:54.700 --> 04:59.170
We will use two libraries that are launch and launch.

04:59.170 --> 04:59.950
Ross.

05:00.860 --> 05:05.870
Since these two libraries contain many modules and many functionalities.

05:05.960 --> 05:13.070
As a general guideline, you can think of the launch library as containing the functionalities for managing

05:13.070 --> 05:19.790
and configuring the launch file itself and its interface with the outside world, such as, for example,

05:19.790 --> 05:27.350
the interface offered to the user or also to other launch files that are using it, as well as its interface

05:27.350 --> 05:30.170
with the operating system and other applications.

05:30.650 --> 05:38.060
Instead, the launch underscore Ross Library contains functionalities that are specific to Ross two,

05:38.270 --> 05:42.080
such as managing Ross two nodes and parameters.

05:43.040 --> 05:48.890
In the next laboratory lesson, we will see how to use this tool to reproduce all the steps required

05:48.920 --> 05:51.680
to visualize the Erdf model of the robot in.

05:52.280 --> 05:56.690
But this time using only one terminal and only one command.
