WEBVTT

00:00.080 --> 00:05.930
In this lesson, we will use the Ros2 command line tool to introspect the interfaces that we have built

00:05.930 --> 00:11.210
and well, in fact, you've already seen the most important command line tools you can use here.

00:11.210 --> 00:15.890
I will make a global reminder, so maybe you can understand things that you might have missed.

00:15.890 --> 00:17.810
And there's going to be a few more tips.

00:17.810 --> 00:24.410
So the first very important thing is to make sure that all terminals are sourced, because maybe you

00:24.410 --> 00:29.270
have built an interface or a node somewhere, and you are still using a terminal that you have sourced

00:29.270 --> 00:31.550
previously, but not after building.

00:31.790 --> 00:39.020
And so the best thing we can do sometimes is just close all the terminals and then just open new ones,

00:39.650 --> 00:46.400
okay, because everything is sourced from the bashrc, we know that now we have all the terminals correctly

00:46.400 --> 00:46.970
sourced.

00:46.970 --> 00:48.500
Then to see an interface.

00:48.500 --> 00:50.270
We have already used that several times.

00:50.270 --> 01:00.530
Ros2 interface show for example using an existing package that was already installed in example interfaces,

01:01.160 --> 01:06.570
um, msg and let's say int 64.

01:07.140 --> 01:07.410
Okay.

01:07.440 --> 01:08.940
We can see the interface.

01:08.940 --> 01:11.220
We can also do Ros2 interface.

01:11.550 --> 01:14.910
Show my robot interfaces.

01:15.060 --> 01:18.120
SV compute rectangle area.

01:18.120 --> 01:25.530
So you see to show the interfaces from the global Ros2 installation or from our workspace is exactly

01:25.530 --> 01:26.130
the same.

01:26.160 --> 01:29.250
Okay, we are going to treat the interfaces the same way.

01:29.280 --> 01:34.320
Now there is another command you can use with Ros2 interface it's list.

01:34.320 --> 01:41.490
And that's going to list all of the interfaces that are installed and sourced in that environment.

01:41.550 --> 01:43.740
And that's going to be a lot.

01:43.890 --> 01:44.400
Okay.

01:44.430 --> 01:48.660
You can see there are quite a few interfaces actually.

01:48.660 --> 01:49.680
It's quite a lot.

01:49.830 --> 01:50.490
Okay.

01:50.610 --> 01:55.800
And you can see packages like for example geometry messages example interfaces.

01:55.830 --> 01:56.070
Okay.

01:56.100 --> 01:59.040
So you see a lot of things that we've used already.

01:59.040 --> 02:01.410
So there you have all the interfaces.

02:01.440 --> 02:05.250
Then for example let's do clear.

02:05.280 --> 02:12.610
If you want to see the interfaces for one package you can do Ros2 interface and then package.

02:13.120 --> 02:16.900
And then for example, my robot interfaces.

02:16.900 --> 02:19.360
You see the auto completion should work here.

02:20.260 --> 02:23.410
And we have all the interfaces for that package.

02:23.410 --> 02:24.880
So we have created two.

02:24.910 --> 02:30.250
Now let's do this command again for sensor messages.

02:30.250 --> 02:33.010
You see that package that we have seen before.

02:33.040 --> 02:36.010
This package is installed already for you.

02:37.120 --> 02:42.310
And we can find all of the messages in the sensor messages package.

02:43.030 --> 02:51.700
And then for each message you can do a Ros2 interface show if you want to see, for example, that one

02:51.700 --> 02:52.990
magnetic field.

02:53.380 --> 02:56.230
Okay, you can see this one is really quite complex.

02:56.230 --> 03:02.830
But what you can see, you can use Ros2 interface list, Ros2 interface package and Ros2 interface show

03:02.830 --> 03:06.730
to discover the different interfaces that you have installed.

03:06.730 --> 03:15.540
Now, if you have a running node like for example, the let's do hardware status publisher.

03:15.570 --> 03:21.390
If you have a running node, there are a few ways you can find the different topics and services and

03:21.390 --> 03:23.970
see what interface you need to use.

03:24.000 --> 03:27.360
Okay, so we've already seen that with Ros2 node.

03:27.390 --> 03:35.040
So you can find the node list and then rose to node info with that node.

03:35.220 --> 03:41.490
We can find already you see we have a publisher here with the name and we can already see the interface.

03:41.490 --> 03:43.500
So that's one way to find it.

03:43.500 --> 03:53.550
Then we can also do Ros2 topic list and then ros2 topic info with that topic name.

03:53.610 --> 03:56.250
And we also find the same information.

03:56.280 --> 03:56.640
Okay.

03:56.640 --> 04:00.810
So there are several ways to get to the same conclusion from the command line.

04:00.840 --> 04:10.980
Now let's stop that and let's start the add to int server that we've created in the section on services.

04:10.980 --> 04:12.930
So this time we have a service.

04:13.950 --> 04:20.770
Let's do a Ros two node list and then rust two node info.

04:22.330 --> 04:27.850
And you can see in the service list that's here.

04:27.880 --> 04:33.490
Service servers we have our service name and the interface.

04:34.150 --> 04:34.450
Right.

04:34.480 --> 04:37.900
And you can also do roles to service list.

04:39.340 --> 04:46.150
And then you have roles to service type with the name of the service.

04:46.240 --> 04:48.550
And we find the type again.

04:48.580 --> 04:49.000
All right.

04:49.000 --> 04:53.800
So it's quite easy to find the interface for existing topics and services.

04:53.800 --> 05:00.550
And to conclude here it's important to make the difference between the communication layer and the actual

05:00.550 --> 05:02.170
content of the communication.

05:02.200 --> 05:02.530
Okay.

05:02.560 --> 05:06.880
So the service for example the service here name and the topics.

05:06.880 --> 05:09.190
Those are the communication layers.

05:09.190 --> 05:13.570
And they are transporting some messages some interfaces.

05:13.570 --> 05:20.290
So the interface is the actual content that you send over the topic or over the service.
