WEBVTT

00:00.080 --> 00:03.200
Now you can create your own Python and Cplusplus nodes.

00:03.200 --> 00:05.150
You've also learned how to launch them.

00:05.150 --> 00:12.050
So for both Python and Cplusplus, after you install the node, you get an executable inside the install

00:12.050 --> 00:13.970
folder of your roster workspace.

00:13.970 --> 00:20.240
And finally, you've also seen that you can use a command line tool named Ros to run to start the node.

00:20.240 --> 00:25.400
As you will see in this lesson, it will give you more control over the nodes that you are starting.

00:25.400 --> 00:27.170
So let's experiment a bit.

00:27.200 --> 00:32.660
We're gonna review some stuff you already know with the Ros2 command line and then learn new stuff.

00:32.660 --> 00:35.060
So you open first a terminal.

00:35.060 --> 00:40.640
And just as a quick recap, make sure that you have correctly sourced the environment.

00:40.670 --> 00:50.060
Okay, so if I show you the bash SC so cat bash RC here, you see at the end I have my line to source

00:50.060 --> 00:56.420
the global Ros2 installation and then the line to source the workspace.

00:56.690 --> 01:02.350
And here well make sure you just replace that with whatever distribution you are using.

01:02.350 --> 01:03.520
And that's very important.

01:03.520 --> 01:05.110
So you can run ros2 stuff.

01:05.110 --> 01:09.040
And so you can also run the stuff you've installed in your workspace.

01:09.040 --> 01:10.570
So let's clear that.

01:10.570 --> 01:15.490
And as we just opened a terminal the bashrc is automatically executed.

01:15.490 --> 01:16.720
So here nothing to do.

01:16.750 --> 01:19.810
So let's come back to this ros2 command line.

01:19.810 --> 01:24.040
If I just put Ros2 space and then I do tab twice.

01:25.390 --> 01:27.520
You see I have all the different functionalities.

01:27.520 --> 01:29.740
So those are quite a lot.

01:29.770 --> 01:33.100
We're going to see some of the most important ones in this course.

01:33.100 --> 01:36.700
And the one we've already used is Ros2 run.

01:36.700 --> 01:39.370
So with Ros to run you can start a node.

01:39.400 --> 01:44.680
To start a node you need to provide the package name and then the executable name okay.

01:44.710 --> 01:53.860
So for example we have started in the installation section demo nodes CP that's the package name.

01:53.860 --> 01:58.210
And you should be able to use the Autocompletion with tab okay.

01:58.260 --> 02:00.480
So nodes and then see tab.

02:00.480 --> 02:03.570
We have demo nodes cp and then space.

02:03.570 --> 02:06.780
And then you're going to provide the name of the executable.

02:06.780 --> 02:10.350
So here we had so you can press tab twice for example.

02:10.770 --> 02:13.530
You see we have a lot of executables here.

02:13.530 --> 02:17.550
And we have run previously the Docker executable okay.

02:17.580 --> 02:23.610
So Ros to run and then the package and then the executable I press enter.

02:23.610 --> 02:26.220
And you see that we are starting a node okay.

02:26.250 --> 02:28.410
And I press Ctrl C to stop.

02:28.410 --> 02:34.980
So that's a node that's already installed for you in the global Ros2 installation.

02:35.520 --> 02:36.750
Now let's do clear.

02:36.750 --> 02:41.520
And we can start the nodes that we have just created in our workspace.

02:41.520 --> 02:43.290
So I can do Ros to run.

02:43.320 --> 02:50.670
Then my for example Pi PG with you see I use the Autocompletion again and then the node.

02:50.670 --> 02:55.590
Well if you don't remember the name of the executable for that node, you just press tab twice.

02:55.590 --> 03:01.190
And you see here we have the auto autocompletion that puts automatically by node because we only have

03:01.190 --> 03:03.380
one executable for now.

03:03.620 --> 03:04.250
All right.

03:04.250 --> 03:06.980
So package executable.

03:07.010 --> 03:08.300
I run that.

03:08.480 --> 03:08.990
Okay.

03:08.990 --> 03:13.610
And then I do control C and I can do the same with the other package.

03:13.760 --> 03:19.160
So I put CP package and then I press tab twice if I don't remember.

03:19.190 --> 03:19.520
Okay.

03:19.550 --> 03:20.540
CP node.

03:20.540 --> 03:25.850
And we start the C plus plus node that we have created.

03:25.880 --> 03:30.470
I'm just going to show you what happens if you haven't sourced the workspace.

03:30.470 --> 03:35.990
So let's open I'm going to open it with Git Bash RC.

03:36.860 --> 03:41.540
I am just going to comment that line here and save the file.

03:41.990 --> 03:42.260
Okay.

03:42.290 --> 03:45.680
So when I open a new terminal I'm going to do a new window here.

03:45.860 --> 03:51.710
That terminal is going to be sourced for the global Ros2 installation but not for the workspace.

03:51.710 --> 03:56.750
So if I try to do Ros2 run my pi By PG.

03:56.780 --> 03:59.750
Here you will not have the autocompletion anyway.

04:00.410 --> 04:01.820
So mypy PG.

04:01.820 --> 04:03.470
And then that was py node.

04:03.500 --> 04:07.400
You see that I will have package not found.

04:07.400 --> 04:14.660
So if you have this error with a package that you have created yourself, that is very likely because

04:14.660 --> 04:18.200
you haven't correctly sourced the workspace.

04:18.200 --> 04:24.260
Or maybe you have the correct source line in the bashrc, but then you have created and built the package

04:24.260 --> 04:27.440
in one terminal and you haven't sourced the terminal again.

04:27.440 --> 04:31.070
So in this case source the bashrc or open a new terminal.

04:31.580 --> 04:31.910
Okay.

04:31.940 --> 04:37.670
So now I'm going to close that and just put back and save and close.

04:40.550 --> 04:41.840
All right now let's continue.

04:41.840 --> 04:45.230
And let's discover other functionalities of the Ross two command line.

04:45.230 --> 04:48.530
For this I'm going to open some terminals.

04:48.920 --> 04:52.670
I'm going to open for like that with Terminator.

04:52.670 --> 04:58.390
So if you don't know how I did this you can go back to the installation section and I explain everything.

04:58.390 --> 05:01.810
So we have the Ros2 run command line.

05:01.810 --> 05:07.060
Actually if you want to have more information with any thing you just type dash h for help.

05:07.060 --> 05:10.810
And you see you have an explanation with what you have to give here.

05:10.810 --> 05:12.910
For example package name executable.

05:12.910 --> 05:14.620
You can also give some arguments.

05:14.620 --> 05:15.700
We're going to see that later.

05:15.700 --> 05:20.830
And we're going to see another command which is ros2 node.

05:20.830 --> 05:26.470
And with Ros2 node you will be able to introspect the nodes that are currently running.

05:26.470 --> 05:28.510
So we have Ros2 node list.

05:28.510 --> 05:32.170
And you can see Ros2 node list is returning nothing.

05:32.170 --> 05:35.380
This is going to list all the nodes that are currently running.

05:35.380 --> 05:37.450
So now we have zero node.

05:37.960 --> 05:47.170
Let's do Ros to run my pi pkg with pi node okay it's running.

05:47.170 --> 05:49.300
Now let's run this again.

05:49.510 --> 05:53.140
And you can see I have pi tests okay.

05:53.170 --> 05:54.300
Let's do Ross.

05:54.330 --> 06:01.680
To run my cp pg with CP node.

06:01.920 --> 06:04.680
So we have two nodes running.

06:05.280 --> 06:05.790
I do.

06:05.820 --> 06:09.750
Ross two node list and we have you see CP test and pi test.

06:09.750 --> 06:12.900
So we can see all the nodes that are running.

06:12.960 --> 06:14.250
Now you can do something else.

06:14.250 --> 06:19.890
You can also do Ross two node info to get more information about a specific node.

06:19.890 --> 06:22.740
And for that you need to provide the name of the node.

06:22.740 --> 06:26.310
So it's quite useful to do node list first.

06:26.310 --> 06:30.480
And then you can just take a for example that one CP test.

06:30.480 --> 06:37.740
So starting with slash here you press enter and you have more information here.

06:39.870 --> 06:45.300
So you see that for this node we have all of those subscribers publishers.

06:45.300 --> 06:48.810
So that corresponds to topics which we're going to see later.

06:48.810 --> 06:53.480
And we have all of the service servers and service clients here that also we're going to see later.

06:53.480 --> 06:58.070
So with this you see what rose to communications this node is using.

06:58.070 --> 07:02.570
And by default there are a few ones for parameters for log etc..

07:02.600 --> 07:02.990
All right.

07:02.990 --> 07:04.520
So it can be quite useful.

07:04.520 --> 07:09.620
And you can do also ros2 node and then dash h for the help.

07:10.370 --> 07:14.930
And you can see the different commands info list okay.

07:14.960 --> 07:16.460
And how you can use them.

07:16.850 --> 07:17.240
Great.

07:17.240 --> 07:19.520
So let's come back to the previous view.

07:19.520 --> 07:23.630
And well let's stop those.

07:23.630 --> 07:25.280
So that's about it for now.

07:25.280 --> 07:31.460
You have the Ros2 run command and you have the rose two node with list and info.

07:31.910 --> 07:34.760
With that you can start nodes and introspect nodes.

07:34.760 --> 07:40.610
Now there is one important thing to remember when you start nodes is that you cannot have two nodes

07:40.610 --> 07:42.170
with the same name.

07:42.200 --> 07:46.820
Okay, so when you have the rose two node list, you should not have two nodes with the same name.

07:46.820 --> 07:50.030
And how to make sure that you don't have two nodes with the same name.

07:50.030 --> 07:52.580
Well, let's go to the next video.
