In this section we have learned about making our own simulation 2 2
models and utilizing ROS2 plugins in order to interact 3 3
with it. 4 4
Now Let's use what you learned to recreate the robot model 5 5
I would show in my visual explanations. 6 6
This robot has a base, four wheels and a Rod which has a 7 7
camera attached to it. 8 8
So I want you to recreate a robot that looks similar to this 9 9
that you can drive around and view the camera data from. 10 10
Pause this video and give yourself some time to complete 11 11
this project or you can follow along with me. 12 12
Alright, so first I'm going to create my model which I will 13 13
do within the Gazebos Model editor. 14 14
Then I'll go ahead and create a base. 15 15
Then I will create my wheel. 16 16
Then I can go ahead and duplicate this wheel by right clicking 17 17
on it, selecting copy, and then I'll go ahead and paste it. 18 18
Now when I do my control for the wheels, rather than having 19 19
two sets of driving wheels, I'm just gonna have the front 20 20
wheels be the ones which drive around. 21 21
This means I should reduce the friction on the back wheels 22 22
so that my robot can easily make turns. 23 23
Then I will make the Rod which holds the camera. 24 24
Now I will make the box which goes on top of the Rod to 25 25
act as the camera. 26 26
It is worth noting by default, the camera plugin I will be 27 27
using, faces towards the positive X axis, which is represented 28 28
by this red line here. 29 29
So I need to make sure that the X axis of the Cube faces 30 30
towards the front of my robot. 31 31
Now for the joint, I will join together my front wheels first 32 32
and go from left to right. 33 33
Now I will join the camera to the base. Lastly, join the 34 34
camera box to the Rod which is connected to the base. 35 35
Okay, with that, I will save my model. 36 36
I will save this as 'project underscore bot'. 37 37
I save and I can go ahead and exit the model editor. 38 38
And here we see our model in the gazebo world. 39 39
For now I'll go ahead and close Gazebo and we'll go ahead 40 40
and finish editing the model within Atom. 41 41
Okay, for clarity sake, I will rename 'link zero' to 'base' and 42 42
'link three' to 'camera link'. 43 43
Okay, here I have two other world files which I went over 44 44
in the previous lecture, and I will go ahead and copy the 45 45
'diff drive' plugin to the bottom of my model SDF file. 46 46
Then I will configure the plugins. 47 47
Alright, I'll have to get the joint names which has our base 48 48
connecting to our wheels. 49 49
And so if you remember, I connected my front left wheel first. 50 50
So Let's go ahead and find the very first joint which will 51 51
be right here. 52 52
So it's called base joint zero. 53 53
I'll go ahead and copy this name, and place it as our left 54 54
joint for the plug in. 55 55
And then for our right joint, it will be base joint one for 56 56
the wheel separation. 57 57
I had put my wheels about 0.6 meters away from each other, 58 58
and then for the wheel diameter, they are 0.5 meters. 59 59
I'll just change chassis to base for the robot base frame, 60 60
and I will just change the Odom demo frame to just say do. 61 61
All right, then we can go over to the ROS camera world file, 62 62
and I'll copy the camera plugin, and so I'll have to put 63 63
it within my camera link. 64 64
So if I Scroll up here, I can paste it in. 65 65
I can go ahead and change the update rate since 66 66
I don't need 60 Hertz. 67 67
I'm okay with just 20, and I don't want an image being visualized 68 68
within the simulation, so I can just set this tag to false. 69 69
Then for the namespace, 70 70
I will change this to Project Bot. 71 71
And these remapping don't even currently work right now, 72 72
so I can actually just go ahead and delete them for now. 73 73
And with that, that should be it for the configuring of our 74 74
camera. So I can go ahead and save this file. 75 75
And now I can reopen my terminal. 76 76
Now I can start a gazebo and make sure it's utilizing the 77 77
ROS functionality. We can go to insert and we can go ahead 78 78
and insert our Project Bot model. 79 79
Then I can go ahead and open up RQT so we can start visualizing 80 80
and publishing data to our model. 81 81
So now just to double check that this works, I can go ahead 82 82
and set the speed to say 1. 83 83
And if I go ahead and publish to this, I can indeed see that 84 84
my robot is moving. 85 85
Now, Let's add some variety to our environment, so we don't 86 86
just see two gray rectangles for our image feed. 87 87
So I'll go ahead here and insert in some objects. 88 88
What else can we get here? 89 89
And now in our camera feed, we can indeed see the SUV, which 90 90
is in front of our robot, and we can drive around our environment 91 91
to look around. 92 92
Alright, so we see that our robot is indeed moving around, 93 93
and we see that we're facing our ambulance. 94 94
That's what we can see. 95 95
We can see the SUV, and we can see the fire truck. 96 96
We can drive around freely. 97 97
--- 98 98
Okay, it seems I just keep doing Donuts here. 99 99
All right with that. 100 100
Congratulations on creating your own robotic simulation. 101 101
In this project, 102 102
you created a simulation model which utilizes ROS2 plugins 103 103
to allow you to see a camera feed from the robot as well 104 104
as drive it around your simulated environment.