Hi robotic enthusiasts.
In this lesson, we will finally put together all the pieces of our robot and see in this simulation
how they interact with each other, coordinated and interconnected by Ros2.
This is also the last lesson in which we are going to add functionalities to our robot, as the focus
in the next section will be on making all these functionalities compatible with the real robot.
To start all the robot's functionalities, let's create one last package inside our workspace.
So inside the source folder here, let's create the package with the Ros2 package create and let's use
as a build type arm and CMake.
As we are not going to insert any Python or Cplusplus file in this package, but we just want to develop
some launch files and let's call this package Arduino bot bring up.
So let's press enter.
And this created our new last package.
So the Arduino bot bring up package.
Now back in the workspace let's run docker build command so that the Arduino bot bring up packages recognized
and compiled.
Now back in Visual Studio Code.
Close the terminal.
Back in Visual Studio Code in the Arduino bot bring up.
Let's start by creating a new launch file.
So by convention let's insert this one in the launch folder.
And within this folder let's create a new file called simulated robot dot launch dot pi.
In this one, since this is a ros2 launch file, let's start by importing the launch description class.
So from the launch library let's import the launch description.
Then let's define The generate launch description function, which returns an object of type launch
description, and the constructor of this class requires as input a list.
So the list of the functionalities that this launch file is going to start.
The object of this launch file is to declare all the applications.
So all the functionalities that we want to be started.
And so all the functionalities for the simulated robot.
So let's start by launching gazebo.
And we have already inserted and launched all the simulation component.
In another launch file.
So basically we want to start this one here the gazebo dot launch.
And so in order to start another launch file.
So this one from this launch file from the simulated robot we need to import another library.
So from launch Actions we need to Import the include launch description.
And so let's use this one to launch gazebo.
So let's create a new instance of this class of the include launch description.
And also let's import from the amend index Python from the packages module.
Let's import the get package share directory.
And let's use it within this one to get the directory to the package which contains the launch file
that we want to start.
So we want to start the gazebo dot launch which is in the Arduino bot description.
Then within this package we want to access to the launch folder.
So let's import the OS library of Python in order to access to our file system.
And so now let's use here the function OS but join.
So let's copy this one and let's move it here.
And so we want to access to the Arduino bot description package.
So this returns the directory of the Arduino bot description package.
Within this one we want to access to the launch folder.
And from this one we want to start the file that is called gazebo dot launch dot pi.
After the simulation we want also to start the controller of our robot, and also for this one, there
is already a launch file ready that we have already created.
And is this one the controller dot launch.
So basically we can copy this the same instructions.
We can paste it here and let's format it like this.
The controller.
So the controller launch.
Pi is in the Arduino board controller package and the file is called Controller Launch dot Pi.
To this launch file we can pass also some arguments.
So here let's pass some launch arguments.
And let's pass a dictionary.
And let's set the argument is the theme of the launch file.
So is seem to be true since we want to start the control system of the robot for the simulated robot.
And let's take the items of this dictionary.
Then we also need to start move it.
So let's start.
Move it.
And again let's copy these lines here.
Since also the move it launch file is already created and is in the Arduino bot move it package.
So let's change the name of the package to be Arduino Bot.
Move it and the launch file is the move it dot dot pi.
So move it dot launch dot pi.
And also in this case let's set the argument is a seem to be true.
Finally we only need to start one last component.
So one last functionality which is the remote interface.
And this is in charge of communicating with the Amazon Alexa assistant and also with the move it to
APIs.
So let's use another include launch description.
So let's copy it and paste since also for the Arduino bot remote, in order to start all the functionalities,
we created this launch file here.
So the remote interface dot launch.
So this is in the Arduino bot remote package in the launch folder and is called remote.
Interface dot launch.
And in this case we don't need to provide any launch argument with this.
We have declared and initialized all the components.
So all the application that this launch file.
So the simulated robot launch must start.
Now we just need to add them here within the launch description in order to actually execute them when
we execute the launch file.
So let's start with the gazebo, then the controller, then move it, and finally the remote interface.
Let's save.
And with this launch file we have started all the functionalities of the robot that we have developed
so far during the course.
For now, we only started them for the simulated robot.
That's why this is called simulated Robot Launch.
And in the next section of the course we are going to make all these functionalities compatible also
with the real robot.
So with the real manipulator you can use also this launch file as a starting point for your future experiments.
And so you can just add here all the new nodes and all the new launch files that implements the new
functionalities that you have developed for your robot before executing it.
So before launching this file, let's remember to install it.
So back in the CMake list.
So here we need to add an install statement in order to install the directory launch.
So the one that we have just created and the destination.
So the destination in which we want to install this folder is the shared directory.
And then the subfolder that has the same name of the package.
So Arduino bot bring up and we can access with the variable project name.
Now let's save this file.
Let's also remember to add the dependency from the Ros2 launch.
So let's add a dependency from the Ros2 launch within the package dot XML.
Since we created our launch file, and now we are ready to start and to see the result of our work.
So the outcome of what we have learned throughout the course.
So let's open a new terminal here.
Let's go to the workspace and let's start by building it.
So we are compiling the Arduino board bring up package.
And so the new launch file that we have created.
Now if we open a new window of the terminal and here we source the file setup dot bash.
So this one here we can start all the functionalities of the robot.
So all the software that we have developed in this course with just one command that is Ros2 launch.
And from the Arduino board bring up package.
Let's start all the functionalities of the robot in the simulated environment.
So by using the simulated robot dot launch dot pi.
So let's press enter.
And this command is starting.
Now the simulation of our robot in gazebo.
It is also starting the control system of the robot.
And also as we can see here, it is starting also our RV's with move it.
And so we can interact with our robot using the RVs graphical user interface.
So this one here.
Now however we are not going to use it, but we are just going to use Alexa.
So the voice assistant in order to send commands.
So to send the tasks to our robot.
And so to move it into a peak position and also into a rest position.
In order to do so we need to start Ngrok.
So we need to start the web server that actually runs on our PC, and that we are going to use in order
to connect with the Alexa interface.
To do so, let's go to the downloads folder in which we have downloaded Ngrok, and then let's use the
command ng rock and let's open an HTTP server on the port 5000.
Perfect.
Now we have a new address that is this one here.
So now we can copy it.
So let's copy it.
And now this is the address that we need to set.
So this is the address that we need to copy in the Alexa developer console.
So let's open it.
Here we go.
This is the Alexa developer console.
Let's set this one on one side.
And let's set gatsibo on the other side so that we can see that when we will send commands using the
Alexa interface, we will see our robot moving.
So here the first thing that we need to do is to go to the endpoint section here.
And we need to change here the endpoint to the new one that was provided by Ngrok.
Let's save it.
Perfect.
And now we can go testing our model.
So we can go testing our interaction model with the robot.
So here we can start interacting with Alexa voice assistant.
And for example we can also write commands.
So let's use the invocation name that is wake up Arduino bot.
Hi.
How can we help.
And this is the response that we were expecting.
And we can see that the robot is opening its gripper to welcoming us.
And now we can say, for example, pick that pen.
Okay, I'm moving and we can see that the robot is going picking some invisible object in the gazebo
simulation.
And also the gripper is closing.
And so now we have the confirmation that all this task that we have developed in this course is perfectly
working from the Alexa interface to our robot.
So the robot simulation and also the move it and the move it APIs that are making all of this possible.