Let's experiment with an already existing package that provides you with a simplified 2D simulation
of a robot.
This package is named Turtle SIM.
This will be a good opportunity to apply what you've learned with the Ros two tools in this section,
and we will often come back to Turtle SIM during the course, and at the end of the course, you will
do a complete project based on that simplified robot.
So let's start it right away.
How to start.
You open a terminal and you do Ros two run.
Because anytime we're going to start a node we do Ros to run.
So in which package the node is the package is named turtle SIM.
And you can also use auto completion.
It should be found.
And then the executable is named turtle SIM node like that.
So Rosrun turtle sim turtle sim node.
If you get an error here.
If it's turtle sim not found, then you can install it with sudo apt install and then ros dash.
I'm going to write distro for distribution, but you replace it with your current Ross distribution
and then dash turtle sim.
You see, it's very easy to install a package, but it should already be here when we installed Ross
two in the installation section.
That's part of the desktop install for Ross two, so you should not have any problem.
So let's press enter.
And you see we have a new window.
So I'm going to put that on the side here.
All right.
Like this.
So as you can see a node for now we've only started nodes that print stuff in the terminal.
But a node can also be uh it can also have a graphical view.
All right.
So this node will spawn a turtle here you see in this small window.
And you see we also have some logs about spawning a turtle etc..
Now in a second terminal I'm going to start another node.
And this node will be able to control that turtle.
So let's do Ros2 run.
And that's going to also be the total SIM package.
But then turtle is going to be turtle Teleop key.
Okay.
So once again auto completion restaurant turtle sim turtle Teleop key I press enter and you see this
node is going to read from the keyboard.
So we can use the arrow keys to move the turtle.
So make sure that you select this terminal okay not any other terminal.
Make sure you select this terminal.
And then let's press on the arrow keys.
And you can see the turtle here is moving as I press on the keys.
So it seems that this node is actually communicating with that node.
How well we are going to find out.
Let's run our cut graph.
So I run it on a third terminal.
Okay.
If needed you can click on this to refresh and you can also change to nodes only or nodes topics.
All right.
You can have different views here.
And let's go to nodes only.
But it's going to be the same.
And so you can see that we have our turtle sim.
That's the node we have started here on that terminal.
And then we have the teleop.
Turtle.
That's the node we have started here.
And you can see they are communicating between each other.
So the Teleop Turtle key is sending here some messages to the turtle SIM with this turtle one Cmdvel.
So what is that.
This is a topic.
So that's a good transition with the next section that's going to be focused on topics.
You will understand everything about the topics.
All right.
So what we can guess for now is that this terminal here will start a node that reads from the keyboard
and then sends a command to that node here, which is going to output the command and give it to the
turtle on the screen.
Great.
Now let's for example let's stop that node and let's run it again.
And this time I'm going to use.
So let's put it like that I'm going to use dash dash Ross args and then dash R to remap the node.
And let's name it my total.
So I want to rename the node I press enter.
So we have the total SIM here.
Again different total but doesn't matter.
And then I can refresh the view and you see that.
So here the view has switched okay.
The sides have switched.
But you see we still have the top total node here.
And then we have my total.
So you can rename the node.
And as you can see as we rename the node we also see this on our graph.
All right so we have discovered the basics of this total SIM node.
We are going to come back to this quite often in this course including in the final project.
And before we start to look at topics in the next section, let's practice a bit more with what you've
learned so far in this section.