WEBVTT

00:00.320 --> 00:07.070
After so much talking about movie two, let's finally see how to integrate our robot with this software

00:07.070 --> 00:13.100
and configure it to be able to directly move the robot's gripper in the three dimensional space and

00:13.100 --> 00:18.470
calculate trajectories that move the robot from an initial configuration to a final one.

00:18.830 --> 00:24.380
Since we are adding new functionalities to the robot, let's start by creating a new package.

00:24.530 --> 00:30.080
So in the terminal, let's go to the workspace and into the SRC sub folder.

00:30.080 --> 00:33.080
And here let's create a new package with the two.

00:33.970 --> 00:36.610
Package create command.

00:36.970 --> 00:48.130
Let's use as a build type, amend CMake and let's name this package Arduino but move it.

00:49.630 --> 00:52.330
And let's press enter to create this package.

00:52.330 --> 00:56.350
So now we can see that we have the Arduino board Movete package.

00:56.470 --> 01:04.330
So let's go back to the workspace folder and let's build it again so that the new package is recognized

01:04.330 --> 01:10.090
and we can start inserting configuration files for move it inside this new package.

01:10.240 --> 01:18.520
So we can see here that the Arduino board moved here, is recognized and compiled now back in Visual

01:18.520 --> 01:19.360
Studio code.

01:20.280 --> 01:24.480
Let's open the Arduino board movete package that we have just created.

01:24.720 --> 01:30.450
And here, let's start by creating some configuration files that we are going to use to customize some

01:30.450 --> 01:32.970
of the movie functionalities for our robot.

01:33.270 --> 01:40.890
By convention, let's put all of these configuration files inside a new folder called config.

01:40.890 --> 01:50.130
And within this folder let's create a new file called Arduino bot dot s r DF.

01:50.250 --> 01:51.940
So let's press enter.

01:51.960 --> 02:04.920
This is still an XML file, so let's use the XML tag and then let's set the version to be the 1.0 and

02:04.920 --> 02:08.400
the encoding to be UTF eight.

02:09.230 --> 02:12.170
Then let's close the XML tag.

02:12.200 --> 02:18.320
This file has a structure that is very similar to the one that we used for our robots RDF model.

02:18.350 --> 02:27.020
In fact, like our RDF model of the robot, it also contains a robot tag and we can still assign it

02:27.230 --> 02:35.360
a name and let's call it Arduino bot and it will contain some additional information to the ones that

02:35.360 --> 02:41.930
are available in the RDF model and that it needs for the planning and for the execution of the trajectories.

02:42.570 --> 02:46.800
First, let's create two separate groups for the robot's joints.

02:47.040 --> 02:55.290
So let's create two containers that are called group and let's create a second one, a second group,

02:55.290 --> 02:57.330
and let's name the first group.

02:57.330 --> 03:02.490
So this one, let's name it the arm group.

03:02.490 --> 03:09.150
And this one will contain the joints that belongs to the robot's arm, including also the virtual joint.

03:09.360 --> 03:13.530
So let's start with the first one.

03:15.180 --> 03:20.430
That is the virtual joint.

03:20.430 --> 03:24.660
And then it also contains the first three movable joints of the arm.

03:24.840 --> 03:27.450
So the joints one, two and three.

03:28.350 --> 03:35.250
So let's add a new joint, and this one is called Joint one.

03:35.560 --> 03:40.410
Then let's copy this one and let's paste it three times.

03:41.400 --> 03:48.640
And so we are saying that the joint one, two and three, so the three of them belong to the ARM group.

03:48.790 --> 03:50.890
And also let's add a new joint.

03:51.700 --> 04:02.230
And this last one is the horizontal arm to clone support.

04:02.230 --> 04:08.620
And this this is horizontal, horizontal arm to close a port.

04:08.620 --> 04:12.160
And as you might remember, this is the last joint of the arm.

04:12.160 --> 04:15.670
So the one that connects actually the arm to the gripper.

04:16.440 --> 04:22.590
So let's define the second group and let's call this one gripper.

04:22.890 --> 04:25.380
And it contains the joints of the gripper.

04:25.380 --> 04:30.870
So basically it contains the joint.

04:33.630 --> 04:34.140
For.

04:36.610 --> 04:42.060
And then let's copy this one and let's paste it.

04:42.070 --> 04:43.870
And also the joint five.

04:45.090 --> 04:45.570
Next.

04:45.570 --> 04:49.350
For each group, we need to define a starting configuration.

04:49.350 --> 04:55.080
So we need to define a starting configuration of the joints of the robot so the joints that belong to

04:55.080 --> 04:56.730
each of these groups.

04:57.320 --> 05:07.220
So let's do so out of the group tags and we need to use the group state tag.

05:07.250 --> 05:11.720
So let's define to group states one of for each of the two groups.

05:11.810 --> 05:13.760
So group state.

05:14.630 --> 05:15.950
Okay, now we have two.

05:16.100 --> 05:21.890
And so the first one, let's call this one name home.

05:22.070 --> 05:25.730
And this refers to the home position for the group arm.

05:25.730 --> 05:29.780
So the group is the arm group.

05:30.050 --> 05:35.960
And now let's just set for the initial configuration, the value of all the joints that belong to the

05:35.960 --> 05:37.040
arm to zero.

05:37.190 --> 05:50.420
So for example, the joint one, let's set the value of the joint 1 to 0 and also let's do the same

05:50.420 --> 05:52.760
for the Joints two entry.

05:52.760 --> 05:58.170
So for all the movable joints that belong to the ARM group.

05:58.170 --> 06:00.180
So let's set their state to zero.

06:00.830 --> 06:02.630
Now for the gripper.

06:02.750 --> 06:06.470
So let's call the initial configuration also home.

06:07.370 --> 06:13.220
And the group which we refer to is the gripper.

06:13.700 --> 06:19.730
And also in this case, we need just to set the initial position of the joint.

06:21.680 --> 06:27.620
That is called joint four and its value.

06:27.650 --> 06:28.790
Let's set also to zero.

06:28.790 --> 06:34.550
So in this case, we don't need to set also the position of the joint five as as we said, for the two

06:34.550 --> 06:39.950
control library, the joint five will copy will mimic the movements of the joint four.

06:41.080 --> 06:44.500
As the final step for this SDF file.

06:44.530 --> 06:50.680
We also need to set up the collisions, so we need to configure the pairs of link among which we want

06:50.680 --> 06:54.520
to disable the collision control that is offered by Moovit.

06:54.760 --> 06:59.080
So this is useful especially for those links that are next to each other.

06:59.080 --> 07:04.270
And so therefore they are, let's say, always in collision or simply they are in contact with each

07:04.270 --> 07:04.690
other.

07:04.690 --> 07:07.150
For example, let's disable the collision.

07:07.150 --> 07:19.810
So disable collision between the link one that is the base link.

07:20.050 --> 07:24.940
And the link to that is the base plate.

07:24.970 --> 07:30.040
This way, basically move it to will not check for the collision among these two links.

07:30.040 --> 07:34.660
And so among the two meshes that are attached to these two links.

07:34.660 --> 07:38.410
And the reason is because they are adjacent.

07:38.410 --> 07:41.090
So at adjacent.

07:41.480 --> 07:46.070
Next, let's copy this one and let's paste it below.

07:46.070 --> 07:53.540
In order to disable the collision between the base link and the forward drive.

07:54.460 --> 08:00.100
Arm and let's never check this collision.

08:00.880 --> 08:11.500
Then let's also copy this one and let's avoid the collision check between this time the base plate and

08:11.500 --> 08:15.820
the forward drive arm and also then the closer port.

08:20.460 --> 08:26.100
And the forward drive arm and then also between the close support.

08:29.880 --> 08:31.590
And the gripper left.

08:35.560 --> 08:37.740
And then the one with the gripper.

08:37.750 --> 08:38.290
Right.

08:38.620 --> 08:42.190
So let's copy this one with the gripper.

08:43.660 --> 08:44.540
Right.

08:44.560 --> 08:49.870
And then also another one between the forward drive arm.

08:51.130 --> 08:57.940
So this one and the gripper left and the forward drive arm and the gripper.

08:58.780 --> 08:59.500
Right.

09:00.310 --> 09:10.540
Then let's also add a new one between the forward drive arm and the horizontal arm.

09:10.540 --> 09:19.000
And then still with the gripper left between the gripper left and the horizontal arm.

09:20.360 --> 09:22.510
And then the other one with the gripper.

09:22.520 --> 09:23.120
Right.

09:24.530 --> 09:25.730
So gripper.

09:27.380 --> 09:28.040
Right.

09:28.040 --> 09:29.660
And the horizontal arm.

09:29.660 --> 09:36.050
And then the last one that is between the gripper left and between the gripper.

09:36.050 --> 09:36.650
Right.

09:36.860 --> 09:38.180
Let's save this file.

09:38.180 --> 09:42.890
And this configuration file is completed so we can move on with the next one.

09:42.980 --> 09:46.340
So let's create a new file still within the config folder.

09:46.520 --> 09:53.570
And let's call this one initial positions dot yaml.

09:53.570 --> 09:55.970
So this time this is a Yaml file.

09:56.210 --> 10:00.800
And here for each of the robots movable joint, we need to add a position.

10:00.800 --> 10:02.630
So an initial configuration.

10:02.630 --> 10:09.950
So let's add initial position and for example, let's set all the joints to zero.

10:09.950 --> 10:14.840
So joint 1 to 0 and then let's copy this one.

10:16.910 --> 10:18.830
And let's paste it below.

10:19.940 --> 10:25.070
And so we have joined two, three and four, all set to zero.

10:25.490 --> 10:30.380
And also, let's save this file and we can create another configuration file.

10:30.380 --> 10:31.640
So still here.

10:31.820 --> 10:36.470
And let's call this one joint limits.

10:37.190 --> 10:39.050
Still, this is a Yaml file.

10:39.170 --> 10:44.750
And in this file, as you might have guessed from the name, we need to specify the kinematic limit

10:44.750 --> 10:46.190
for each movable joint.

10:46.310 --> 10:50.280
So let's start by setting the default velocity scaling factor.

10:50.300 --> 11:13.550
So default velocity scaling factor to 0.1 and the default acceleration scaling factor again to 0.1.

11:13.730 --> 11:20.010
And this reduces the maximum speed and the maximum acceleration with which the robot will be asked to

11:20.010 --> 11:20.370
move.

11:20.370 --> 11:22.170
And so to follow the trajectories.

11:23.000 --> 11:25.490
Now we can use the joint limits.

11:25.490 --> 11:33.560
So let's set the joint limits to assign some limits to all the movable joints of the robot.

11:33.680 --> 11:36.710
So let's start with the joint one.

11:36.710 --> 11:38.570
And this has velocity limits.

11:38.570 --> 11:48.490
So let's set these velocity limits to true, and then let's set the maximum velocity to ten.

11:48.500 --> 11:53.390
So let's put this one inside because this one belongs to the joint one.

11:53.840 --> 11:58.760
So let's set the max velocity to ten.

11:59.830 --> 12:02.950
And it doesn't have instead acceleration limit.

12:02.950 --> 12:04.360
So let's set these

12:06.430 --> 12:10.660
acceleration limits to false.

12:10.660 --> 12:18.790
And so let's leave the maximum acceleration to zero since it will not be used here.

12:18.790 --> 12:24.940
We're missing the two dots since we are going to use the same motors with the same properties for all

12:24.940 --> 12:26.620
the movable joints of the robot.

12:26.650 --> 12:28.840
We can copy these limits.

12:28.850 --> 12:32.140
So these parameters here also for the other joints.

12:32.140 --> 12:33.880
So let's copy these.

12:34.670 --> 12:35.840
Three more times.

12:35.840 --> 12:41.750
And so let's set the properties for the joint to three and also for the joint four.

12:43.250 --> 12:47.000
And finally the joint five here.

12:47.970 --> 12:52.980
Let's also save this file and let's continue by creating another configuration file.

12:52.980 --> 13:01.590
So still within the config folder, let's create a new file and this one is called kinematic dot Yaml.

13:01.860 --> 13:08.390
In this file we need to declare and configure the kinematic solver that move it has to use for our robot.

13:08.400 --> 13:15.720
So we only need to use a kinematic solver for the group of joints that we called arm that actually compose

13:15.720 --> 13:20.350
the actual arm of the robot and let's use one that is available in the

13:23.250 --> 13:24.420
kinematics.

13:27.300 --> 13:28.560
Plugin package.

13:28.560 --> 13:37.920
And specifically let's use the k d, l kinematics plugin.

13:39.090 --> 13:40.740
Then let's also set the parameter

13:42.840 --> 13:53.810
kinematics solver search resolution to be 0.05.

13:53.820 --> 14:04.980
And also let's set the kinematics solver timeout to be 0.005.

14:05.670 --> 14:11.160
Here the resolution is 0.005.

14:11.580 --> 14:20.610
And finally, let's set one last parameter that is called position only inverse kinematic.

14:20.790 --> 14:23.400
And let's set this one to true.

14:23.640 --> 14:28.300
This parameter is useful since our robot has only three degrees of freedom.

14:28.300 --> 14:34.930
And so we are asking the inverse kinematic solver to define only the position in the space of the robot.

14:34.930 --> 14:37.450
So if the gripper and not its orientation.

14:37.450 --> 14:43.720
So we don't want to specify the orientation of the gripper in the space, since we don't have enough

14:43.720 --> 14:47.770
number of degrees of freedom, we don't have enough actuator for our robot.

14:48.100 --> 14:52.660
So let's save this file and let's add another configuration file.

14:52.900 --> 14:57.520
So let's create here a new configuration file that we can call Move It

14:59.770 --> 15:01.060
controllers.

15:01.480 --> 15:07.960
This is still a Yaml configuration file and we use this configuration file to connect the move library

15:07.960 --> 15:14.140
with the Ros2 control library that we have already configured for our robot and therefore with the controllers

15:14.140 --> 15:16.600
that we used to move the robot's joints.

15:17.080 --> 15:24.820
So let's specify the parameters for the move IT controller manager.

15:25.330 --> 15:31.240
And so we want to use the move it simple

15:33.640 --> 15:34.960
controller Manager.

15:34.960 --> 15:46.660
So from this package we want to use the move it simple controller manager and then let's configure this

15:46.660 --> 15:48.190
simple controller manager.

15:48.370 --> 15:55.750
So let's configure the move it simple controller manager informing that there are two controllers actually

15:55.750 --> 15:57.970
that we want to configure for our robots.

15:58.150 --> 16:09.340
And there are the arm controller and also the gripper controller and these are the names of the two

16:09.340 --> 16:10.240
controllers.

16:10.240 --> 16:15.130
So the arm controller and the gripper controller are the names of the two controllers that we have configured

16:15.130 --> 16:19.000
for our robot using the Ros to control library.

16:19.570 --> 16:31.420
Now regarding the arm controller, this offers an action with the namespace follow joint trajectories.

16:31.420 --> 16:39.640
So let's use the action namespace that is the follow joint

16:41.830 --> 16:52.960
trajectory and the type of the action that it offers is follow joint trajectory as we have defined when

16:52.960 --> 16:56.410
we configured the arm controller for the Ros2 control.

16:56.770 --> 17:00.430
And also let's set the default configuration for this action.

17:02.020 --> 17:05.500
So let's use the true in order to use the default configuration.

17:05.710 --> 17:10.780
And also then we need to set which are the joints that are actuated by this controller.

17:10.780 --> 17:22.570
So the joints that are actuated by the arm controller are the joint one, the joint two and the joint

17:22.570 --> 17:23.080
three.

17:23.230 --> 17:30.600
Now regarding the gripper controller, this also use the same namespace.

17:30.600 --> 17:39.690
So the action namespace is still follow joint trajectory and also it uses the follow joint controller.

17:40.890 --> 17:43.530
And also let's set the default to true.

17:44.820 --> 17:52.710
And this time the joints that are actuated by this one, so by the gripper controller are the joint

17:52.710 --> 17:58.710
four and also the joint five that simply mimics the behavior of the joint four.

17:59.220 --> 18:00.990
Let's save also this file.

18:01.140 --> 18:04.710
And next we need to create one last configuration file.

18:04.710 --> 18:15.120
So here let's create this new file that is called p, l, e, z, Cartesian limits.

18:15.780 --> 18:17.730
And this is a yaml file.

18:18.000 --> 18:23.250
And in this file we need to specify the limits during the Cartesian movements of the robot.

18:23.250 --> 18:25.950
So the ones along the x, y and.

18:26.070 --> 18:40.590
Z-axis so Cartesian limits of the robot and let's set the max translational velocity to be 1.0.

18:40.830 --> 18:45.210
Then the max transactional

18:47.220 --> 18:50.970
acceleration to be 2.25.

18:51.180 --> 18:59.700
Then the maximum transactional deceleration to be minus five.

19:00.030 --> 19:09.420
The maximum maximum rotational velocity to be, for example, 1.57.

19:10.280 --> 19:13.400
Let's also save this last configuration file.

19:13.730 --> 19:19.670
The last configuration that we need for the proper execution of Movie2 is to change the default implementation

19:19.670 --> 19:21.980
of the DDS used by Ros2.

19:22.610 --> 19:29.540
In fact, as we can see from the official wiki of Movie2, they are currently having some issues with

19:29.540 --> 19:33.110
the default implementation that comes with ros2.

19:33.290 --> 19:37.250
So here they suggest to switch to cyclone DDS.

19:37.430 --> 19:43.040
And so in order to do so, let's start by installing this implementation of DDS.

19:43.190 --> 19:48.260
So let's open a new terminal and let's copy this command here.

19:48.530 --> 19:52.100
You need to change with the Ros2 version that you are using.

19:52.220 --> 19:54.930
That in my case is ros2 humble.

19:54.950 --> 20:00.320
So let's press enter in order to install this implementation.

20:04.250 --> 20:10.610
And then in order to start actually using this implementation of DDS, we need to copy this line here

20:10.610 --> 20:14.180
and we need to paste it within the bash RC file.

20:14.270 --> 20:18.890
So let's use vim to modify the file dot bash.

20:19.220 --> 20:23.300
RC And here at the end of the file, let's add this line.

20:23.660 --> 20:27.020
So let's close and save the bash.

20:27.020 --> 20:27.350
RC.

20:27.680 --> 20:33.730
And now from the next time we will open a new terminal Roscoe will use by default cyclone DDS.

20:33.740 --> 20:40.280
So the one suggested by move it to for the communication and the message exchange protocol as this implementation

20:40.280 --> 20:42.170
is fully compatible with move.

20:43.220 --> 20:48.860
For now, this configuration files are all we need for launching and executing.

20:48.860 --> 20:50.810
Move it for our robot.

20:50.810 --> 20:57.470
And so to use the modules of inverse kinematics, trajectory planning and also trajectory execution.

20:58.190 --> 21:03.840
However, before concluding this lesson, I wanted to show you an alternative way to generate the Moovit

21:03.860 --> 21:06.080
configuration for a specific robot.

21:06.110 --> 21:10.790
In fact, instead of manually writing all of these configuration files.

21:10.790 --> 21:17.390
So here that we created inside the Arduino bot Moovit package move, it also offers a graphical interface

21:17.390 --> 21:22.040
called Setup Assistant to configure the features for your robot.

21:22.340 --> 21:31.190
So we can launch this functionality by opening a new terminal and using the command Ros to launch and

21:31.190 --> 21:36.320
from the Moovit setup assistant package.

21:36.440 --> 21:40.040
Let's start the setup assistant dot launch dot pi.

21:40.550 --> 21:42.350
So let's press enter.

21:42.350 --> 21:49.100
And now in this guy you can load, for example, the robot's Urdf model, which will automatically configure

21:49.100 --> 21:55.160
then some parameters such as, for example, automatically ignoring the collisions between the robots

21:55.160 --> 22:01.010
link during the planning or also automatic detect, which are the controllers that are used and so on.

22:01.460 --> 22:07.790
Upon completing then the moovit configuration with this tool, with the setup assistant, all the packages

22:07.790 --> 22:11.660
and all the configuration files are also then created automatically.

22:12.290 --> 22:19.040
However, normally this tool generates many more configuration files with many more parameters which

22:19.040 --> 22:24.980
are deemed unnecessary for the purpose of this tutorial and for the robot's functionalities in order

22:24.980 --> 22:31.280
to offer you a cleaner code and also a cleaner configuration parameters with fewer parameters that you

22:31.280 --> 22:34.730
can easily understand and also that you can easily tune.
