WEBVTT

00:00.110 --> 00:06.140
Let's experiment with an already existing package that provides you with a simplified 2D simulation

00:06.140 --> 00:07.220
of a robot.

00:07.250 --> 00:09.800
This package is named Turtle SIM.

00:09.800 --> 00:14.960
This will be a good opportunity to apply what you've learned with the Ros two tools in this section,

00:14.960 --> 00:19.460
and we will often come back to Turtle SIM during the course, and at the end of the course, you will

00:19.460 --> 00:23.120
do a complete project based on that simplified robot.

00:23.120 --> 00:24.860
So let's start it right away.

00:24.860 --> 00:25.760
How to start.

00:25.760 --> 00:29.210
You open a terminal and you do Ros two run.

00:29.240 --> 00:32.600
Because anytime we're going to start a node we do Ros to run.

00:32.600 --> 00:38.990
So in which package the node is the package is named turtle SIM.

00:39.020 --> 00:40.790
And you can also use auto completion.

00:40.790 --> 00:42.200
It should be found.

00:42.200 --> 00:48.920
And then the executable is named turtle SIM node like that.

00:48.920 --> 00:52.790
So Rosrun turtle sim turtle sim node.

00:52.790 --> 00:54.530
If you get an error here.

00:54.530 --> 01:01.310
If it's turtle sim not found, then you can install it with sudo apt install and then ros dash.

01:01.310 --> 01:07.510
I'm going to write distro for distribution, but you replace it with your current Ross distribution

01:07.510 --> 01:10.360
and then dash turtle sim.

01:10.390 --> 01:16.750
You see, it's very easy to install a package, but it should already be here when we installed Ross

01:16.750 --> 01:18.280
two in the installation section.

01:18.280 --> 01:23.560
That's part of the desktop install for Ross two, so you should not have any problem.

01:23.560 --> 01:25.210
So let's press enter.

01:25.450 --> 01:27.460
And you see we have a new window.

01:27.460 --> 01:31.030
So I'm going to put that on the side here.

01:32.530 --> 01:32.980
All right.

01:32.980 --> 01:33.610
Like this.

01:33.610 --> 01:38.860
So as you can see a node for now we've only started nodes that print stuff in the terminal.

01:38.860 --> 01:43.810
But a node can also be uh it can also have a graphical view.

01:43.990 --> 01:44.320
All right.

01:44.350 --> 01:50.290
So this node will spawn a turtle here you see in this small window.

01:50.290 --> 01:54.010
And you see we also have some logs about spawning a turtle etc..

01:54.040 --> 01:58.210
Now in a second terminal I'm going to start another node.

01:58.210 --> 02:01.750
And this node will be able to control that turtle.

02:01.750 --> 02:04.080
So let's do Ros2 run.

02:04.080 --> 02:08.610
And that's going to also be the total SIM package.

02:08.820 --> 02:14.910
But then turtle is going to be turtle Teleop key.

02:14.940 --> 02:15.300
Okay.

02:15.330 --> 02:23.790
So once again auto completion restaurant turtle sim turtle Teleop key I press enter and you see this

02:23.790 --> 02:25.980
node is going to read from the keyboard.

02:26.100 --> 02:28.530
So we can use the arrow keys to move the turtle.

02:28.530 --> 02:32.700
So make sure that you select this terminal okay not any other terminal.

02:32.700 --> 02:34.710
Make sure you select this terminal.

02:34.710 --> 02:36.780
And then let's press on the arrow keys.

02:36.780 --> 02:42.240
And you can see the turtle here is moving as I press on the keys.

02:43.650 --> 02:49.560
So it seems that this node is actually communicating with that node.

02:49.590 --> 02:51.990
How well we are going to find out.

02:52.020 --> 02:54.180
Let's run our cut graph.

02:54.450 --> 02:57.270
So I run it on a third terminal.

03:00.120 --> 03:00.660
Okay.

03:00.660 --> 03:09.950
If needed you can click on this to refresh and you can also change to nodes only or nodes topics.

03:09.980 --> 03:10.400
All right.

03:10.400 --> 03:12.470
You can have different views here.

03:12.470 --> 03:14.540
And let's go to nodes only.

03:14.570 --> 03:15.830
But it's going to be the same.

03:15.830 --> 03:19.280
And so you can see that we have our turtle sim.

03:19.400 --> 03:22.670
That's the node we have started here on that terminal.

03:22.670 --> 03:24.110
And then we have the teleop.

03:24.140 --> 03:24.560
Turtle.

03:24.560 --> 03:26.270
That's the node we have started here.

03:26.270 --> 03:29.270
And you can see they are communicating between each other.

03:29.270 --> 03:37.670
So the Teleop Turtle key is sending here some messages to the turtle SIM with this turtle one Cmdvel.

03:37.730 --> 03:38.780
So what is that.

03:38.780 --> 03:40.010
This is a topic.

03:40.220 --> 03:44.060
So that's a good transition with the next section that's going to be focused on topics.

03:44.060 --> 03:47.540
You will understand everything about the topics.

03:47.570 --> 03:47.870
All right.

03:47.900 --> 03:53.660
So what we can guess for now is that this terminal here will start a node that reads from the keyboard

03:53.690 --> 03:59.780
and then sends a command to that node here, which is going to output the command and give it to the

03:59.780 --> 04:01.070
turtle on the screen.

04:01.070 --> 04:01.550
Great.

04:01.580 --> 04:07.780
Now let's for example let's stop that node and let's run it again.

04:07.780 --> 04:09.760
And this time I'm going to use.

04:09.880 --> 04:18.160
So let's put it like that I'm going to use dash dash Ross args and then dash R to remap the node.

04:18.820 --> 04:22.030
And let's name it my total.

04:22.030 --> 04:25.360
So I want to rename the node I press enter.

04:25.900 --> 04:28.180
So we have the total SIM here.

04:28.180 --> 04:30.400
Again different total but doesn't matter.

04:30.400 --> 04:34.390
And then I can refresh the view and you see that.

04:34.390 --> 04:37.630
So here the view has switched okay.

04:37.660 --> 04:39.220
The sides have switched.

04:39.220 --> 04:41.860
But you see we still have the top total node here.

04:41.860 --> 04:43.360
And then we have my total.

04:43.360 --> 04:44.620
So you can rename the node.

04:44.620 --> 04:49.600
And as you can see as we rename the node we also see this on our graph.

04:49.840 --> 04:53.740
All right so we have discovered the basics of this total SIM node.

04:53.740 --> 04:58.390
We are going to come back to this quite often in this course including in the final project.

04:58.390 --> 05:04.180
And before we start to look at topics in the next section, let's practice a bit more with what you've

05:04.180 --> 05:06.160
learned so far in this section.
