At this point, we have all the components needed to start the control system of our robot in the simulated
environment of gazebo, and send commands to the robot to see how it responds to those commands.
So let's open a new terminal here.
Let's go to the workspace and let's build it with Qualcomm Build.
Perfect.
Then in a new window of the terminal let's source the file setup bash that is in the install folder.
And let's start the gazebo simulation of our robot with Ros2 launch.
And from the Arduino board description package let's start the gazebo launch dot Pi.
So this will start the simulation of our robot in the empty gazebo world.
So here we go.
This is our robot.
And now within this world, we want to see how we can activate the gripper of our robot.
So this one here.
And so we need to start also the control system of the robot.
So let's make this one a little bit bigger.
And let's open a new window of the terminal.
Also here let's source the file setup bash, and let's launch with Ros2 launch from the Arduino bot
controller package.
Let's start the controller.launch.py file that we have created.
So let's press enter.
And now we can see that as we started the controller.
So if we make this one a little bit bigger we can see that actually the ARM controller, the gripper
controller and also the joint state broadcaster are properly configured.
And also they are active.
So this means that we can start using them in order to move the simulated robot.
And so this actually interacted with here the controller manager.
And so here we can see also that the controller manager was able to activate and configure all the controllers.
Also we can confirm this.
So we can confirm that actually the control system of the robot is up and running by opening a new terminal.
And we can use the command rose to control.
So this is a command that is available thanks to the Ros2 control library and which we can use in order
to interact with this library.
And so in order to get information about the current status of the Ros2 control for our robot.
So if we press tab twice, for example, we can see that we have all of these commands that are available
in order to inspect and in order to interact with the Ros2 control library.
For example, let's use the list controllers command.
So let's press enter.
And here we can see that all of these are the controllers that are currently active.
So we can see that we have the joint state broadcaster the gripper controller and also the ARM controller.
Here we have their types.
So for example we now are interested just in the gripper controller that is of type forward command
controller.
And also we can see that all of them are active.
Also we can use the command Ros2 Control list.
Hardware components.
And we can use this command.
So let's press enter.
Perfect.
And this one provides us with all the hardware components that are now loaded in the gazebo simulation.
So in the Ros2 control library for gazebo.
And we can see that we have the joint one, the joint two, the three and the four.
And all of them are actually available.
And also we can use the command list hardware interfaces.
So let's press enter.
And here we get a list of all the hardware interfaces that now we have loaded.
So we have the command interface.
That is the way that we can send commands to the joints.
And so we can see that we can send position commands.
So to all the joints.
And also we have the state interface.
And also in this case we can see that the type of the state interface is a position state interface
for all the joints.
And this means that we will get the state of the robot in form of position, so we will know the position
of the robot.
Now I invite you also to try here all the other commands that are available in the Ros2 control library.
So here, as you can see, all of these are other comments that you can use in order to interact with
the library.
As for sure, you will find yourself using this library.
So the Ros2 control library for all your future projects.
For now, let's just see how can we use the gripper controller?
So this one here, in order to move our gripper in the simulated environment.
To do so, we can use the Ros two topic list command.
Perfect.
And now among all the topics that are available we can see that here we have the gripper controller
commands.
And also here we have the ARM controller joint trajectory.
And this means that we can move the arm by sending a full trajectory.
So here with this interface here Or we can move the gripper by sending just a command.
So let's do so.
Let's move the gripper by publishing with Ros two topic poop in the gripper.
Controller commands.
Topic.
Perfect.
Now let's use tab twice.
And so we can see that this one here is the interface.
So the message that is accepted in this topic.
So let's publish a message of this type.
Then let's use the double quotes.
Then let's press tab twice.
Perfect.
And so we can see that this is the empty prototype of this message.
So let's type the letter L and let's press tab again.
And so perfect.
So this is an empty prototype of the float 64 Multiarray.
And here the only field that we need to change is here the data field in which we want to send the command
for the joint for of the robot.
So the one that activates the gripper, this one here.
And actually for example let's set it to minus one.
We don't need to set a command for the joint five as it will move along with the joint four.
So basically we are asking the joint four to move one radius so minus one radian.
So let's press enter.
And as we send this command we can see that both the fingers of the robot are opening.
And so until they reach the position of minus one radian.
And so we can see also that we send a command just for the joint four.
So this one here, but also the joint five was moved because it simply copying the behavior of the joint
four.
Now we can also close the gripper by sending the message zero.
So it will go back to the position zero.
And as we can see here now the gripper is closing.
So it's reaching the angle zero radians.
Perfect.
And so this confirms us that the control system of our robot and in this case the control system of
the gripper is perfectly working.
Now before closing this lesson however, remember that here in the Arduino bot controller, in the config
and in the Arduino bot controllers.
We are using a different interface for the gripper controller that is an interface of type forward command
controller.
And so thanks to this interface, we were able to simply send a command to the gripper.
And the gripper was moving.
But from now on instead of this we want to use this other interface here.
So let's uncomment this row.
And so we are going to use the same interface both to actuate the arm controller and also the gripper
controller.
And so this is a joint trajectory interface.
Basically we will send a trajectory to the gripper.
And this trajectory will tell the gripper where to be.
So how to move at any moment in time.
Also here we need to uncomment these parameters.
Perfect.
And instead we can remove this one that was only useful for the forward controller.
So we can save also this file.
And now from now on we are going to use the same interface for the gripper and also for the arm.