WEBVTT

00:00.140 --> 00:07.070
At this point, we have all the components needed to start the control system of our robot in the simulated

00:07.070 --> 00:13.640
environment of gazebo, and send commands to the robot to see how it responds to those commands.

00:13.730 --> 00:16.340
So let's open a new terminal here.

00:16.340 --> 00:22.430
Let's go to the workspace and let's build it with Qualcomm Build.

00:23.810 --> 00:24.650
Perfect.

00:24.650 --> 00:32.240
Then in a new window of the terminal let's source the file setup bash that is in the install folder.

00:32.240 --> 00:38.030
And let's start the gazebo simulation of our robot with Ros2 launch.

00:38.210 --> 00:44.720
And from the Arduino board description package let's start the gazebo launch dot Pi.

00:47.150 --> 00:51.440
So this will start the simulation of our robot in the empty gazebo world.

00:51.440 --> 00:52.790
So here we go.

00:52.820 --> 00:54.380
This is our robot.

00:54.380 --> 01:00.440
And now within this world, we want to see how we can activate the gripper of our robot.

01:00.440 --> 01:01.850
So this one here.

01:01.850 --> 01:05.220
And so we need to start also the control system of the robot.

01:05.250 --> 01:07.440
So let's make this one a little bit bigger.

01:07.440 --> 01:09.540
And let's open a new window of the terminal.

01:09.540 --> 01:18.390
Also here let's source the file setup bash, and let's launch with Ros2 launch from the Arduino bot

01:18.420 --> 01:19.590
controller package.

01:19.590 --> 01:24.570
Let's start the controller.launch.py file that we have created.

01:24.570 --> 01:26.460
So let's press enter.

01:26.460 --> 01:29.550
And now we can see that as we started the controller.

01:29.550 --> 01:35.340
So if we make this one a little bit bigger we can see that actually the ARM controller, the gripper

01:35.340 --> 01:40.260
controller and also the joint state broadcaster are properly configured.

01:40.260 --> 01:41.790
And also they are active.

01:41.790 --> 01:46.500
So this means that we can start using them in order to move the simulated robot.

01:46.500 --> 01:51.540
And so this actually interacted with here the controller manager.

01:51.570 --> 01:58.170
And so here we can see also that the controller manager was able to activate and configure all the controllers.

01:58.170 --> 01:59.910
Also we can confirm this.

01:59.910 --> 02:06.090
So we can confirm that actually the control system of the robot is up and running by opening a new terminal.

02:06.090 --> 02:10.530
And we can use the command rose to control.

02:10.530 --> 02:16.620
So this is a command that is available thanks to the Ros2 control library and which we can use in order

02:16.620 --> 02:18.330
to interact with this library.

02:18.360 --> 02:24.450
And so in order to get information about the current status of the Ros2 control for our robot.

02:24.450 --> 02:30.930
So if we press tab twice, for example, we can see that we have all of these commands that are available

02:30.930 --> 02:36.240
in order to inspect and in order to interact with the Ros2 control library.

02:36.240 --> 02:42.450
For example, let's use the list controllers command.

02:42.450 --> 02:44.010
So let's press enter.

02:44.010 --> 02:49.560
And here we can see that all of these are the controllers that are currently active.

02:49.560 --> 02:54.660
So we can see that we have the joint state broadcaster the gripper controller and also the ARM controller.

02:54.660 --> 02:56.520
Here we have their types.

02:56.520 --> 03:02.280
So for example we now are interested just in the gripper controller that is of type forward command

03:02.280 --> 03:02.850
controller.

03:02.850 --> 03:06.350
And also we can see that all of them are active.

03:06.350 --> 03:11.760
Also we can use the command Ros2 Control list.

03:15.870 --> 03:19.170
Hardware components.

03:19.170 --> 03:20.610
And we can use this command.

03:20.610 --> 03:22.080
So let's press enter.

03:22.800 --> 03:23.460
Perfect.

03:23.460 --> 03:29.550
And this one provides us with all the hardware components that are now loaded in the gazebo simulation.

03:29.550 --> 03:31.860
So in the Ros2 control library for gazebo.

03:31.860 --> 03:37.080
And we can see that we have the joint one, the joint two, the three and the four.

03:37.080 --> 03:39.660
And all of them are actually available.

03:39.870 --> 03:45.870
And also we can use the command list hardware interfaces.

03:45.870 --> 03:47.430
So let's press enter.

03:47.430 --> 03:51.330
And here we get a list of all the hardware interfaces that now we have loaded.

03:51.330 --> 03:53.820
So we have the command interface.

03:53.820 --> 03:58.530
That is the way that we can send commands to the joints.

03:58.560 --> 04:01.410
And so we can see that we can send position commands.

04:01.410 --> 04:03.330
So to all the joints.

04:03.330 --> 04:05.250
And also we have the state interface.

04:05.250 --> 04:10.410
And also in this case we can see that the type of the state interface is a position state interface

04:10.410 --> 04:11.580
for all the joints.

04:11.580 --> 04:18.310
And this means that we will get the state of the robot in form of position, so we will know the position

04:18.310 --> 04:19.270
of the robot.

04:19.390 --> 04:28.150
Now I invite you also to try here all the other commands that are available in the Ros2 control library.

04:28.150 --> 04:33.250
So here, as you can see, all of these are other comments that you can use in order to interact with

04:33.250 --> 04:33.910
the library.

04:33.910 --> 04:38.320
As for sure, you will find yourself using this library.

04:38.320 --> 04:42.760
So the Ros2 control library for all your future projects.

04:42.760 --> 04:47.980
For now, let's just see how can we use the gripper controller?

04:47.980 --> 04:52.600
So this one here, in order to move our gripper in the simulated environment.

04:52.630 --> 04:58.240
To do so, we can use the Ros two topic list command.

04:58.270 --> 04:59.020
Perfect.

04:59.020 --> 05:04.480
And now among all the topics that are available we can see that here we have the gripper controller

05:04.480 --> 05:05.230
commands.

05:05.230 --> 05:08.950
And also here we have the ARM controller joint trajectory.

05:08.950 --> 05:13.690
And this means that we can move the arm by sending a full trajectory.

05:13.690 --> 05:20.010
So here with this interface here Or we can move the gripper by sending just a command.

05:20.010 --> 05:21.870
So let's do so.

05:21.900 --> 05:30.120
Let's move the gripper by publishing with Ros two topic poop in the gripper.

05:30.210 --> 05:32.220
Controller commands.

05:32.220 --> 05:32.880
Topic.

05:32.910 --> 05:33.450
Perfect.

05:33.480 --> 05:35.250
Now let's use tab twice.

05:35.250 --> 05:38.220
And so we can see that this one here is the interface.

05:38.220 --> 05:41.310
So the message that is accepted in this topic.

05:41.580 --> 05:43.950
So let's publish a message of this type.

05:43.950 --> 05:45.720
Then let's use the double quotes.

05:45.720 --> 05:47.910
Then let's press tab twice.

05:48.060 --> 05:48.780
Perfect.

05:48.810 --> 05:52.470
And so we can see that this is the empty prototype of this message.

05:52.470 --> 05:56.160
So let's type the letter L and let's press tab again.

05:56.160 --> 05:57.210
And so perfect.

05:57.210 --> 06:01.680
So this is an empty prototype of the float 64 Multiarray.

06:01.680 --> 06:07.920
And here the only field that we need to change is here the data field in which we want to send the command

06:07.920 --> 06:10.500
for the joint for of the robot.

06:10.500 --> 06:14.520
So the one that activates the gripper, this one here.

06:14.520 --> 06:18.030
And actually for example let's set it to minus one.

06:18.030 --> 06:23.440
We don't need to set a command for the joint five as it will move along with the joint four.

06:23.440 --> 06:29.740
So basically we are asking the joint four to move one radius so minus one radian.

06:29.890 --> 06:31.690
So let's press enter.

06:31.810 --> 06:37.660
And as we send this command we can see that both the fingers of the robot are opening.

06:37.780 --> 06:42.250
And so until they reach the position of minus one radian.

06:42.250 --> 06:46.840
And so we can see also that we send a command just for the joint four.

06:46.840 --> 06:53.200
So this one here, but also the joint five was moved because it simply copying the behavior of the joint

06:53.200 --> 06:53.860
four.

06:53.890 --> 06:58.900
Now we can also close the gripper by sending the message zero.

06:58.900 --> 07:02.410
So it will go back to the position zero.

07:02.410 --> 07:05.560
And as we can see here now the gripper is closing.

07:05.560 --> 07:09.190
So it's reaching the angle zero radians.

07:09.190 --> 07:10.120
Perfect.

07:10.120 --> 07:15.220
And so this confirms us that the control system of our robot and in this case the control system of

07:15.220 --> 07:18.400
the gripper is perfectly working.

07:18.400 --> 07:25.650
Now before closing this lesson however, remember that here in the Arduino bot controller, in the config

07:25.650 --> 07:27.510
and in the Arduino bot controllers.

07:27.510 --> 07:34.770
We are using a different interface for the gripper controller that is an interface of type forward command

07:34.770 --> 07:35.610
controller.

07:35.610 --> 07:39.780
And so thanks to this interface, we were able to simply send a command to the gripper.

07:39.780 --> 07:41.250
And the gripper was moving.

07:41.250 --> 07:47.130
But from now on instead of this we want to use this other interface here.

07:47.130 --> 07:49.050
So let's uncomment this row.

07:49.050 --> 07:54.420
And so we are going to use the same interface both to actuate the arm controller and also the gripper

07:54.420 --> 07:55.110
controller.

07:55.140 --> 07:57.990
And so this is a joint trajectory interface.

07:57.990 --> 08:01.290
Basically we will send a trajectory to the gripper.

08:01.290 --> 08:04.740
And this trajectory will tell the gripper where to be.

08:04.740 --> 08:07.200
So how to move at any moment in time.

08:07.320 --> 08:11.040
Also here we need to uncomment these parameters.

08:11.100 --> 08:12.000
Perfect.

08:12.000 --> 08:18.120
And instead we can remove this one that was only useful for the forward controller.

08:18.120 --> 08:20.100
So we can save also this file.

08:20.100 --> 08:25.950
And now from now on we are going to use the same interface for the gripper and also for the arm.
