Now you can create your own Python and Cplusplus nodes.
You've also learned how to launch them.
So for both Python and Cplusplus, after you install the node, you get an executable inside the install
folder of your roster workspace.
And finally, you've also seen that you can use a command line tool named Ros to run to start the node.
As you will see in this lesson, it will give you more control over the nodes that you are starting.
So let's experiment a bit.
We're gonna review some stuff you already know with the Ros2 command line and then learn new stuff.
So you open first a terminal.
And just as a quick recap, make sure that you have correctly sourced the environment.
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
the global Ros2 installation and then the line to source the workspace.
And here well make sure you just replace that with whatever distribution you are using.
And that's very important.
So you can run ros2 stuff.
And so you can also run the stuff you've installed in your workspace.
So let's clear that.
And as we just opened a terminal the bashrc is automatically executed.
So here nothing to do.
So let's come back to this ros2 command line.
If I just put Ros2 space and then I do tab twice.
You see I have all the different functionalities.
So those are quite a lot.
We're going to see some of the most important ones in this course.
And the one we've already used is Ros2 run.
So with Ros to run you can start a node.
To start a node you need to provide the package name and then the executable name okay.
So for example we have started in the installation section demo nodes CP that's the package name.
And you should be able to use the Autocompletion with tab okay.
So nodes and then see tab.
We have demo nodes cp and then space.
And then you're going to provide the name of the executable.
So here we had so you can press tab twice for example.
You see we have a lot of executables here.
And we have run previously the Docker executable okay.
So Ros to run and then the package and then the executable I press enter.
And you see that we are starting a node okay.
And I press Ctrl C to stop.
So that's a node that's already installed for you in the global Ros2 installation.
Now let's do clear.
And we can start the nodes that we have just created in our workspace.
So I can do Ros to run.
Then my for example Pi PG with you see I use the Autocompletion again and then the node.
Well if you don't remember the name of the executable for that node, you just press tab twice.
And you see here we have the auto autocompletion that puts automatically by node because we only have
one executable for now.
All right.
So package executable.
I run that.
Okay.
And then I do control C and I can do the same with the other package.
So I put CP package and then I press tab twice if I don't remember.
Okay.
CP node.
And we start the C plus plus node that we have created.
I'm just going to show you what happens if you haven't sourced the workspace.
So let's open I'm going to open it with Git Bash RC.
I am just going to comment that line here and save the file.
Okay.
So when I open a new terminal I'm going to do a new window here.
That terminal is going to be sourced for the global Ros2 installation but not for the workspace.
So if I try to do Ros2 run my pi By PG.
Here you will not have the autocompletion anyway.
So mypy PG.
And then that was py node.
You see that I will have package not found.
So if you have this error with a package that you have created yourself, that is very likely because
you haven't correctly sourced the workspace.
Or maybe you have the correct source line in the bashrc, but then you have created and built the package
in one terminal and you haven't sourced the terminal again.
So in this case source the bashrc or open a new terminal.
Okay.
So now I'm going to close that and just put back and save and close.
All right now let's continue.
And let's discover other functionalities of the Ross two command line.
For this I'm going to open some terminals.
I'm going to open for like that with Terminator.
So if you don't know how I did this you can go back to the installation section and I explain everything.
So we have the Ros2 run command line.
Actually if you want to have more information with any thing you just type dash h for help.
And you see you have an explanation with what you have to give here.
For example package name executable.
You can also give some arguments.
We're going to see that later.
And we're going to see another command which is ros2 node.
And with Ros2 node you will be able to introspect the nodes that are currently running.
So we have Ros2 node list.
And you can see Ros2 node list is returning nothing.
This is going to list all the nodes that are currently running.
So now we have zero node.
Let's do Ros to run my pi pkg with pi node okay it's running.
Now let's run this again.
And you can see I have pi tests okay.
Let's do Ross.
To run my cp pg with CP node.
So we have two nodes running.
I do.
Ross two node list and we have you see CP test and pi test.
So we can see all the nodes that are running.
Now you can do something else.
You can also do Ross two node info to get more information about a specific node.
And for that you need to provide the name of the node.
So it's quite useful to do node list first.
And then you can just take a for example that one CP test.
So starting with slash here you press enter and you have more information here.
So you see that for this node we have all of those subscribers publishers.
So that corresponds to topics which we're going to see later.
And we have all of the service servers and service clients here that also we're going to see later.
So with this you see what rose to communications this node is using.
And by default there are a few ones for parameters for log etc..
All right.
So it can be quite useful.
And you can do also ros2 node and then dash h for the help.
And you can see the different commands info list okay.
And how you can use them.
Great.
So let's come back to the previous view.
And well let's stop those.
So that's about it for now.
You have the Ros2 run command and you have the rose two node with list and info.
With that you can start nodes and introspect nodes.
Now there is one important thing to remember when you start nodes is that you cannot have two nodes
with the same name.
Okay, so when you have the rose two node list, you should not have two nodes with the same name.
And how to make sure that you don't have two nodes with the same name.
Well, let's go to the next video.