WEBVTT

00:00.080 --> 00:01.430
Hi robotic enthusiasts.

00:01.610 --> 00:07.910
In this lesson, we will finally put together all the pieces of our robot and see in this simulation

00:07.940 --> 00:13.250
how they interact with each other, coordinated and interconnected by Ros2.

00:13.970 --> 00:20.090
This is also the last lesson in which we are going to add functionalities to our robot, as the focus

00:20.090 --> 00:26.120
in the next section will be on making all these functionalities compatible with the real robot.

00:26.720 --> 00:32.300
To start all the robot's functionalities, let's create one last package inside our workspace.

00:32.300 --> 00:43.040
So inside the source folder here, let's create the package with the Ros2 package create and let's use

00:43.580 --> 00:47.810
as a build type arm and CMake.

00:47.840 --> 00:54.770
As we are not going to insert any Python or Cplusplus file in this package, but we just want to develop

00:54.770 --> 01:01.780
some launch files and let's call this package Arduino bot bring up.

01:01.780 --> 01:03.580
So let's press enter.

01:03.580 --> 01:06.190
And this created our new last package.

01:06.190 --> 01:08.440
So the Arduino bot bring up package.

01:08.590 --> 01:16.960
Now back in the workspace let's run docker build command so that the Arduino bot bring up packages recognized

01:16.960 --> 01:18.160
and compiled.

01:18.820 --> 01:20.710
Now back in Visual Studio Code.

01:20.860 --> 01:22.090
Close the terminal.

01:22.120 --> 01:25.180
Back in Visual Studio Code in the Arduino bot bring up.

01:25.180 --> 01:28.030
Let's start by creating a new launch file.

01:28.030 --> 01:32.500
So by convention let's insert this one in the launch folder.

01:32.500 --> 01:42.430
And within this folder let's create a new file called simulated robot dot launch dot pi.

01:43.150 --> 01:49.690
In this one, since this is a ros2 launch file, let's start by importing the launch description class.

01:49.690 --> 01:55.660
So from the launch library let's import the launch description.

01:55.660 --> 02:07.160
Then let's define The generate launch description function, which returns an object of type launch

02:07.160 --> 02:11.780
description, and the constructor of this class requires as input a list.

02:11.780 --> 02:15.830
So the list of the functionalities that this launch file is going to start.

02:16.610 --> 02:20.120
The object of this launch file is to declare all the applications.

02:20.120 --> 02:23.390
So all the functionalities that we want to be started.

02:23.390 --> 02:26.330
And so all the functionalities for the simulated robot.

02:26.420 --> 02:28.610
So let's start by launching gazebo.

02:29.870 --> 02:34.070
And we have already inserted and launched all the simulation component.

02:34.100 --> 02:35.630
In another launch file.

02:35.630 --> 02:40.790
So basically we want to start this one here the gazebo dot launch.

02:40.910 --> 02:44.270
And so in order to start another launch file.

02:44.270 --> 02:50.390
So this one from this launch file from the simulated robot we need to import another library.

02:50.420 --> 02:59.920
So from launch Actions we need to Import the include launch description.

02:59.920 --> 03:02.410
And so let's use this one to launch gazebo.

03:02.410 --> 03:07.600
So let's create a new instance of this class of the include launch description.

03:07.750 --> 03:19.210
And also let's import from the amend index Python from the packages module.

03:19.330 --> 03:23.230
Let's import the get package share directory.

03:23.230 --> 03:29.980
And let's use it within this one to get the directory to the package which contains the launch file

03:29.980 --> 03:31.300
that we want to start.

03:31.300 --> 03:35.800
So we want to start the gazebo dot launch which is in the Arduino bot description.

03:40.030 --> 03:43.630
Then within this package we want to access to the launch folder.

03:43.630 --> 03:52.180
So let's import the OS library of Python in order to access to our file system.

03:52.180 --> 03:58.970
And so now let's use here the function OS but join.

03:58.970 --> 04:04.100
So let's copy this one and let's move it here.

04:05.240 --> 04:09.500
And so we want to access to the Arduino bot description package.

04:09.530 --> 04:13.130
So this returns the directory of the Arduino bot description package.

04:13.130 --> 04:17.630
Within this one we want to access to the launch folder.

04:17.630 --> 04:25.280
And from this one we want to start the file that is called gazebo dot launch dot pi.

04:25.880 --> 04:34.220
After the simulation we want also to start the controller of our robot, and also for this one, there

04:34.220 --> 04:37.970
is already a launch file ready that we have already created.

04:37.970 --> 04:41.060
And is this one the controller dot launch.

04:41.060 --> 04:44.420
So basically we can copy this the same instructions.

04:44.420 --> 04:50.780
We can paste it here and let's format it like this.

04:51.140 --> 04:52.280
The controller.

04:52.280 --> 04:53.890
So the controller launch.

04:53.890 --> 05:04.810
Pi is in the Arduino board controller package and the file is called Controller Launch dot Pi.

05:04.840 --> 05:07.930
To this launch file we can pass also some arguments.

05:07.990 --> 05:11.800
So here let's pass some launch arguments.

05:12.160 --> 05:13.840
And let's pass a dictionary.

05:13.840 --> 05:17.350
And let's set the argument is the theme of the launch file.

05:17.350 --> 05:26.650
So is seem to be true since we want to start the control system of the robot for the simulated robot.

05:26.770 --> 05:29.950
And let's take the items of this dictionary.

05:30.280 --> 05:32.170
Then we also need to start move it.

05:32.890 --> 05:34.390
So let's start.

05:34.420 --> 05:35.470
Move it.

05:35.530 --> 05:38.950
And again let's copy these lines here.

05:38.950 --> 05:45.100
Since also the move it launch file is already created and is in the Arduino bot move it package.

05:45.100 --> 05:49.060
So let's change the name of the package to be Arduino Bot.

05:49.090 --> 05:52.890
Move it and the launch file is the move it dot dot pi.

05:52.920 --> 05:56.400
So move it dot launch dot pi.

05:57.030 --> 06:01.380
And also in this case let's set the argument is a seem to be true.

06:02.190 --> 06:05.400
Finally we only need to start one last component.

06:05.400 --> 06:09.390
So one last functionality which is the remote interface.

06:11.640 --> 06:18.000
And this is in charge of communicating with the Amazon Alexa assistant and also with the move it to

06:18.030 --> 06:18.930
APIs.

06:19.140 --> 06:22.980
So let's use another include launch description.

06:23.580 --> 06:29.580
So let's copy it and paste since also for the Arduino bot remote, in order to start all the functionalities,

06:29.580 --> 06:31.590
we created this launch file here.

06:31.590 --> 06:33.870
So the remote interface dot launch.

06:34.380 --> 06:43.710
So this is in the Arduino bot remote package in the launch folder and is called remote.

06:47.070 --> 06:48.840
Interface dot launch.

06:48.840 --> 06:55.300
And in this case we don't need to provide any launch argument with this.

06:55.330 --> 06:57.910
We have declared and initialized all the components.

06:57.910 --> 07:00.670
So all the application that this launch file.

07:00.670 --> 07:04.930
So the simulated robot launch must start.

07:04.960 --> 07:11.080
Now we just need to add them here within the launch description in order to actually execute them when

07:11.080 --> 07:12.550
we execute the launch file.

07:12.580 --> 07:22.720
So let's start with the gazebo, then the controller, then move it, and finally the remote interface.

07:22.990 --> 07:24.250
Let's save.

07:24.280 --> 07:29.590
And with this launch file we have started all the functionalities of the robot that we have developed

07:29.590 --> 07:31.240
so far during the course.

07:31.960 --> 07:35.020
For now, we only started them for the simulated robot.

07:35.020 --> 07:38.080
That's why this is called simulated Robot Launch.

07:38.080 --> 07:43.210
And in the next section of the course we are going to make all these functionalities compatible also

07:43.240 --> 07:44.470
with the real robot.

07:44.470 --> 07:51.540
So with the real manipulator you can use also this launch file as a starting point for your future experiments.

07:51.540 --> 07:57.120
And so you can just add here all the new nodes and all the new launch files that implements the new

07:57.120 --> 08:02.220
functionalities that you have developed for your robot before executing it.

08:02.220 --> 08:06.840
So before launching this file, let's remember to install it.

08:06.840 --> 08:09.270
So back in the CMake list.

08:09.300 --> 08:20.700
So here we need to add an install statement in order to install the directory launch.

08:20.700 --> 08:24.930
So the one that we have just created and the destination.

08:24.930 --> 08:29.700
So the destination in which we want to install this folder is the shared directory.

08:29.700 --> 08:32.580
And then the subfolder that has the same name of the package.

08:32.580 --> 08:39.900
So Arduino bot bring up and we can access with the variable project name.

08:40.140 --> 08:41.970
Now let's save this file.

08:41.970 --> 08:46.590
Let's also remember to add the dependency from the Ros2 launch.

08:46.590 --> 08:53.330
So let's add a dependency from the Ros2 launch within the package dot XML.

08:53.330 --> 08:59.330
Since we created our launch file, and now we are ready to start and to see the result of our work.

08:59.330 --> 09:02.690
So the outcome of what we have learned throughout the course.

09:02.720 --> 09:05.630
So let's open a new terminal here.

09:05.630 --> 09:09.590
Let's go to the workspace and let's start by building it.

09:09.590 --> 09:13.790
So we are compiling the Arduino board bring up package.

09:13.790 --> 09:16.160
And so the new launch file that we have created.

09:16.190 --> 09:22.820
Now if we open a new window of the terminal and here we source the file setup dot bash.

09:23.720 --> 09:27.500
So this one here we can start all the functionalities of the robot.

09:27.500 --> 09:35.690
So all the software that we have developed in this course with just one command that is Ros2 launch.

09:36.110 --> 09:38.840
And from the Arduino board bring up package.

09:38.840 --> 09:43.160
Let's start all the functionalities of the robot in the simulated environment.

09:43.160 --> 09:46.890
So by using the simulated robot dot launch dot pi.

09:46.920 --> 09:48.630
So let's press enter.

09:48.630 --> 09:50.100
And this command is starting.

09:50.130 --> 09:53.370
Now the simulation of our robot in gazebo.

09:53.400 --> 09:56.010
It is also starting the control system of the robot.

09:56.010 --> 10:00.810
And also as we can see here, it is starting also our RV's with move it.

10:00.810 --> 10:06.240
And so we can interact with our robot using the RVs graphical user interface.

10:06.240 --> 10:07.680
So this one here.

10:07.710 --> 10:12.510
Now however we are not going to use it, but we are just going to use Alexa.

10:12.510 --> 10:15.840
So the voice assistant in order to send commands.

10:15.840 --> 10:18.180
So to send the tasks to our robot.

10:18.180 --> 10:22.830
And so to move it into a peak position and also into a rest position.

10:22.830 --> 10:26.100
In order to do so we need to start Ngrok.

10:26.100 --> 10:32.220
So we need to start the web server that actually runs on our PC, and that we are going to use in order

10:32.220 --> 10:35.250
to connect with the Alexa interface.

10:35.340 --> 10:41.730
To do so, let's go to the downloads folder in which we have downloaded Ngrok, and then let's use the

10:41.730 --> 10:50.840
command ng rock and let's open an HTTP server on the port 5000.

10:50.870 --> 10:51.620
Perfect.

10:51.650 --> 10:54.890
Now we have a new address that is this one here.

10:54.890 --> 10:56.750
So now we can copy it.

10:58.070 --> 10:59.660
So let's copy it.

10:59.660 --> 11:02.450
And now this is the address that we need to set.

11:02.450 --> 11:07.340
So this is the address that we need to copy in the Alexa developer console.

11:07.340 --> 11:08.540
So let's open it.

11:08.570 --> 11:09.590
Here we go.

11:09.620 --> 11:11.930
This is the Alexa developer console.

11:11.930 --> 11:14.540
Let's set this one on one side.

11:14.540 --> 11:20.360
And let's set gatsibo on the other side so that we can see that when we will send commands using the

11:20.360 --> 11:23.390
Alexa interface, we will see our robot moving.

11:23.390 --> 11:28.490
So here the first thing that we need to do is to go to the endpoint section here.

11:28.490 --> 11:34.580
And we need to change here the endpoint to the new one that was provided by Ngrok.

11:34.610 --> 11:36.320
Let's save it.

11:36.980 --> 11:37.730
Perfect.

11:37.730 --> 11:40.280
And now we can go testing our model.

11:40.280 --> 11:44.400
So we can go testing our interaction model with the robot.

11:44.430 --> 11:48.480
So here we can start interacting with Alexa voice assistant.

11:48.480 --> 11:50.940
And for example we can also write commands.

11:51.330 --> 11:56.940
So let's use the invocation name that is wake up Arduino bot.

11:58.110 --> 11:58.620
Hi.

11:58.620 --> 11:59.640
How can we help.

11:59.640 --> 12:02.400
And this is the response that we were expecting.

12:02.400 --> 12:06.810
And we can see that the robot is opening its gripper to welcoming us.

12:06.900 --> 12:12.180
And now we can say, for example, pick that pen.

12:14.100 --> 12:21.360
Okay, I'm moving and we can see that the robot is going picking some invisible object in the gazebo

12:21.360 --> 12:22.020
simulation.

12:22.020 --> 12:23.970
And also the gripper is closing.

12:23.970 --> 12:30.090
And so now we have the confirmation that all this task that we have developed in this course is perfectly

12:30.090 --> 12:34.110
working from the Alexa interface to our robot.

12:34.110 --> 12:40.920
So the robot simulation and also the move it and the move it APIs that are making all of this possible.
