In this lesson, we will use the Ros2 command line tool to introspect the interfaces that we have built
and well, in fact, you've already seen the most important command line tools you can use here.
I will make a global reminder, so maybe you can understand things that you might have missed.
And there's going to be a few more tips.
So the first very important thing is to make sure that all terminals are sourced, because maybe you
have built an interface or a node somewhere, and you are still using a terminal that you have sourced
previously, but not after building.
And so the best thing we can do sometimes is just close all the terminals and then just open new ones,
okay, because everything is sourced from the bashrc, we know that now we have all the terminals correctly
sourced.
Then to see an interface.
We have already used that several times.
Ros2 interface show for example using an existing package that was already installed in example interfaces,
um, msg and let's say int 64.
Okay.
We can see the interface.
We can also do Ros2 interface.
Show my robot interfaces.
SV compute rectangle area.
So you see to show the interfaces from the global Ros2 installation or from our workspace is exactly
the same.
Okay, we are going to treat the interfaces the same way.
Now there is another command you can use with Ros2 interface it's list.
And that's going to list all of the interfaces that are installed and sourced in that environment.
And that's going to be a lot.
Okay.
You can see there are quite a few interfaces actually.
It's quite a lot.
Okay.
And you can see packages like for example geometry messages example interfaces.
Okay.
So you see a lot of things that we've used already.
So there you have all the interfaces.
Then for example let's do clear.
If you want to see the interfaces for one package you can do Ros2 interface and then package.
And then for example, my robot interfaces.
You see the auto completion should work here.
And we have all the interfaces for that package.
So we have created two.
Now let's do this command again for sensor messages.
You see that package that we have seen before.
This package is installed already for you.
And we can find all of the messages in the sensor messages package.
And then for each message you can do a Ros2 interface show if you want to see, for example, that one
magnetic field.
Okay, you can see this one is really quite complex.
But what you can see, you can use Ros2 interface list, Ros2 interface package and Ros2 interface show
to discover the different interfaces that you have installed.
Now, if you have a running node like for example, the let's do hardware status publisher.
If you have a running node, there are a few ways you can find the different topics and services and
see what interface you need to use.
Okay, so we've already seen that with Ros2 node.
So you can find the node list and then rose to node info with that node.
We can find already you see we have a publisher here with the name and we can already see the interface.
So that's one way to find it.
Then we can also do Ros2 topic list and then ros2 topic info with that topic name.
And we also find the same information.
Okay.
So there are several ways to get to the same conclusion from the command line.
Now let's stop that and let's start the add to int server that we've created in the section on services.
So this time we have a service.
Let's do a Ros two node list and then rust two node info.
And you can see in the service list that's here.
Service servers we have our service name and the interface.
Right.
And you can also do roles to service list.
And then you have roles to service type with the name of the service.
And we find the type again.
All right.
So it's quite easy to find the interface for existing topics and services.
And to conclude here it's important to make the difference between the communication layer and the actual
content of the communication.
Okay.
So the service for example the service here name and the topics.
Those are the communication layers.
And they are transporting some messages some interfaces.
So the interface is the actual content that you send over the topic or over the service.