WEBVTT

00:00.050 --> 00:01.940
What is a ros2 launch file?

00:01.970 --> 00:03.680
Let's start with the problem.

00:03.680 --> 00:08.150
So let's take the camera driver node we used to explain ros2 parameters.

00:08.150 --> 00:15.080
You start this node for one camera with three parameters the USB device name, the FPS, and a simulation

00:15.080 --> 00:15.950
mode flag.

00:15.980 --> 00:18.530
Note that you can also rename the node here.

00:18.560 --> 00:22.910
Now you want to add another camera driver node for another camera on your robot.

00:22.940 --> 00:29.570
You start a new camera driver node in another terminal, and of course you rename the node and set all

00:29.570 --> 00:30.620
parameters values.

00:30.620 --> 00:33.290
You could also use a YAML file here if you want.

00:33.320 --> 00:35.930
Oh, and there is a third camera on your robot.

00:35.930 --> 00:40.040
So that's another node that you start in another terminal.

00:40.040 --> 00:41.330
And that's not all.

00:41.330 --> 00:45.710
Let's say you want to add a robot new station node with one parameter.

00:45.710 --> 00:48.350
This time your application is still not complete.

00:48.350 --> 00:55.730
You add two LED panel nodes with more remappings and one parameter each, and add etc. etc. you continue

00:55.730 --> 01:02.420
to add nodes to run your application, each node in its own terminal, with all the options required

01:02.420 --> 01:09.150
to name the node, set the parameters, etc. as you can see, that's becoming a real mess and it will

01:09.150 --> 01:11.880
take you forever to launch that every time.

01:11.910 --> 01:16.830
Plus, with all that configuration, you may make some mistakes that will be long to debug.

01:16.830 --> 01:23.100
So at this point you might want to run a script to start everything automatically and not manually.

01:23.100 --> 01:25.980
That way you can truly scale your application.

01:26.010 --> 01:28.470
Well, that's exactly what a launch file does.

01:28.500 --> 01:32.550
Here I have put all the nodes and configuration inside the launch file.

01:32.580 --> 01:37.920
A launch file will allow you to start everything from one single file.

01:37.920 --> 01:45.150
You can start your nodes, apply some remapping, set some parameters, and even load YAML files.

01:45.150 --> 01:50.670
That way you will be able to quickly launch your application and to create different launch files for

01:50.670 --> 01:52.860
different startup modes of your robot.

01:52.890 --> 01:59.130
In a real application, it's not uncommon for a robot to have something like ten nodes and maybe 200

01:59.160 --> 02:00.570
or more parameters.

02:00.570 --> 02:05.880
Without using launch files, it will be impossible to start the robot application.
