1
1

00:00:00,000  -->  00:00:03,990
In this lecture, we will be learning about how to utilize
2

2

00:00:04,000  -->  00:00:07,710
the ROS2 bridge so that we can communicate with systems
3

3

00:00:07,740  -->  00:00:08,880
running ROS1.
4

4

00:00:09,060  -->  00:00:13,380
So the first thing I'm going to do is head over to my bashrc
5

5

00:00:13,390  -->  00:00:20,930
file, which I'll edit in atom at the bottom, we should
6

6

00:00:20,940  -->  00:00:23,450
have our sources for our ROS2 installation.
7

7

00:00:23,540  -->  00:00:28,520
I'm going to go ahead and comment mines out so that no ROS
8

8

00:00:28,760  -->  00:00:29,330
is sourced.
9

9

00:00:29,900  -->  00:00:32,180
I'll go ahead and save this and close.
10

10

00:00:32,680  -->  00:00:37,420
Now, if I open a new terminal, I should be unable to use
11

11

00:00:37,430  -->  00:00:39,730
RO2 or any ROS1 commands.
12

12

00:00:43,820  -->  00:00:48,570
Now we can move on to installing ROS1 onto our system
13

13

00:00:48,580  -->  00:00:51,060
so that we can utilize the bridge here locally.
14

14

00:00:51,260  -->  00:00:55,100
So here I'm on the ROS Noetic installation page since I'm
15

15

00:00:55,110  -->  00:00:56,570
currently running Ubuntu 20.
16

16

00:00:56,660  -->  00:00:59,120
So go ahead and open up a terminal.
17

17

00:00:59,660  -->  00:01:06,720
We'll go ahead and set up our sources list, put in your password,
18

18

00:01:07,880  -->  00:01:10,410
then we'll go ahead and set up our keys.
19

19

00:01:15,040  -->  00:01:17,720
Then we'll run pseudo app update.
20

20

00:01:21,170  -->  00:01:24,000
All right, go ahead and clear the screen.
21

21

00:01:24,010  -->  00:01:27,210
And for the purposes of this video, I'm not going to install
22

22

00:01:27,220  -->  00:01:31,140
the full desktop version of ROS Noetic partly because it
23

23

00:01:31,150  -->  00:01:34,470
will also coincide with my current installations of RViz and
24

24

00:01:34,470  -->  00:01:37,230
gazebo. So instead of what I'm going to do is just simply
25

25

00:01:37,240  -->  00:01:39,900
install the base version of ROS Noetic.
26

26

00:01:39,910  -->  00:01:43,020
So this will just give me the basic packages and communication
27

27

00:01:43,030  -->  00:01:46,260
libraries, no user interface tools or anything like that.
28

28

00:01:46,470  -->  00:01:48,210
So I'll just go ahead and install this.
29

29

00:01:49,530  -->  00:01:50,460
I'll go ahead and hit
30

30

00:01:50,490  -->  00:01:50,670
yes.
31

31

00:01:52,490  -->  00:01:54,960
And so this will take a while to install.
32

32

00:01:54,970  -->  00:01:57,510
So I'll go ahead and pause the video now and we'll come back
33

33

00:01:57,520  -->  00:01:58,230
once it's finished.
34

34

00:01:58,660  -->  00:01:59,660
Alright.
35

35

00:01:59,670  -->  00:02:00,830
So the installation finished.
36

36

00:02:00,840  -->  00:02:03,290
We can just see that all it did was set up all the packages.
37

37

00:02:04,020  -->  00:02:06,540
That took about maybe four minutes for me.
38

38

00:02:06,550  -->  00:02:08,430
So that should have been too bad for you.
39

39

00:02:08,870  -->  00:02:12,300
Now we'll go ahead and move on with the environment set up
40

40

00:02:12,310  -->  00:02:12,660
of this.
41

41

00:02:12,670  -->  00:02:16,080
So in order for us to utilize our ROS1, right, we can't
42

42

00:02:16,090  -->  00:02:16,620
use anything
43

43

00:02:16,630  -->  00:02:16,770
yet.
44

44

00:02:16,780  -->  00:02:19,410
If I use roscore, which is a ROS1 command to start
45

45

00:02:19,420  -->  00:02:20,100
the ROS Master.
46

46

00:02:20,420  -->  00:02:22,940
Even though we have ROS installed, we can't use anything
47

47

00:02:22,950  -->  00:02:24,950
because we haven't set up our environment file.
48

48

00:02:25,100  -->  00:02:29,420
So if I go ahead and source my terminal environment, we should
49

49

00:02:29,430  -->  00:02:31,970
now see that I can run things like roscore.
50

50

00:02:32,320  -->  00:02:33,460
Great.
51

51

00:02:33,470  -->  00:02:37,300
So now this device has ROS1 and ROS2 installed on
52

52

00:02:37,310  -->  00:02:40,850
it. But by default, neither will be sourced on terminal startup.
53

53

00:02:41,820  -->  00:02:46,010
So the next thing we're going to do is we're going to make
54

54

00:02:46,020  -->  00:02:48,380
sure that we have all these other dependencies for building
55

55

00:02:48,390  -->  00:02:51,800
packages. So I'll go ahead and copy and paste this in.
56

56

00:02:52,240  -->  00:02:53,830
Go ahead and hit.
57

57

00:02:53,840  -->  00:02:54,490
"Y" and enter.
58

58

00:02:56,850  -->  00:03:00,820
In most cases, you already have ROS dep installed, but you
59

59

00:03:00,830  -->  00:03:05,130
can double check by pasting in this so we can see I've already
60

60

00:03:05,140  -->  00:03:06,060
have it installed.
61

61

00:03:06,480  -->  00:03:09,060
We can double check that it's initialized by running these
62

62

00:03:09,070  -->  00:03:12,880
commands. So here we can see error sources file already exists.
63

63

00:03:12,890  -->  00:03:15,340
So I'm not going to bother removing that one creating a new
64

64

00:03:15,350  -->  00:03:16,510
one. I'll just leave it as is.
65

65

00:03:17,180  -->  00:03:21,050
Okay, so now we have ROS1 and ROS2 installed and we
66

66

00:03:21,060  -->  00:03:23,720
have our extra dependencies if we have to build any packages.
67

67

00:03:23,870  -->  00:03:26,000
So for now, I'm actually going to start off clean with a
68

68

00:03:26,010  -->  00:03:28,790
new terminal environment that's not sourced on any ROS system.
69

69

00:03:28,800  -->  00:03:35,540
So now if I run ROS2 help see ROS2 command not found
70

70

00:03:35,540  -->  00:03:39,080
or roscore, and we see roscore not found.
71

71

00:03:39,090  -->  00:03:41,630
Okay, so this terminal instance can't see either one of our
72

72

00:03:41,640  -->  00:03:42,500
ROS installations.
73

73

00:03:42,770  -->  00:03:46,070
So now we'll go ahead to the ROS1 bridge documentation.
74

74

00:03:46,300  -->  00:03:48,340
Alright, so here are the prerequisites.
75

75

00:03:48,520  -->  00:03:51,340
We should have majority of these prerequisites from the basic
76

76

00:03:51,350  -->  00:03:54,790
installation. But first off, I'll go ahead and source the
77

77

00:03:54,800  -->  00:03:57,490
ROS1 installation, as these are catered towards the ROS1
78

78

00:03:57,490  -->  00:03:58,360
installation.
79

79

00:03:58,720  -->  00:04:04,470
So I'll do source/opt/ros/noetic.
80

80

00:04:04,480  -->  00:04:04,980
---
81

81

00:04:07,680  -->  00:04:11,250
And so now I should have access to my tools like roscore
82

82

00:04:11,640  -->  00:04:13,080
and we can see I do.
83

83

00:04:13,770  -->  00:04:16,470
Now I'll just make sure that I have all these other packages
84

84

00:04:16,480  -->  00:04:19,880
installed, which I can do using pseudo apt install.
85

85

00:04:20,740  -->  00:04:24,590
And then we do ROS the name of the distribution which in
86

86

00:04:24,600  -->  00:04:26,270
this case for me is Noetic.
87

87

00:04:26,780  -->  00:04:28,580
And then the name of the package.
88

88

00:04:28,590  -->  00:04:33,170
So things like catkin, roscpp, roslaunch, rosmsg
89

89

00:04:33,180  -->  00:04:35,960
should all be already installed because that comes with the
90

90

00:04:35,970  -->  00:04:36,800
basic installation.
91

91

00:04:36,800  -->  00:04:39,920
The main things we're going to be missing though, are going
92

92

00:04:39,930  -->  00:04:42,950
to be those that are utilized for the examples including
93

93

00:04:42,960  -->  00:04:45,500
the tutorials and the RQT image view.
94

94

00:04:45,680  -->  00:04:48,350
So I can go ahead and install those specifically.
95

95

00:04:50,990  -->  00:04:54,810
And note instead of using underscores when using the pseudo
96

96

00:04:54,820  -->  00:04:58,110
apt command, you should use just a simple dash when you see
97

97

00:04:58,120  -->  00:05:00,270
the package name separated by underscores.
98

98

00:05:02,490  -->  00:05:05,550
So as you can see here, instead of doing roscpy_tutorials
99

99

00:05:05,560  -->  00:05:10,410
I am doing roscpy-tutorials, but that correlates
100

100

00:05:10,420  -->  00:05:11,430
to the correct package.
101

101

00:05:13,360  -->  00:05:17,210
And then last but not least, I'll install the RQT image view.
102

102

00:05:24,330  -->  00:05:25,330
Alright.
103

103

00:05:25,330  -->  00:05:27,250
And we should be good to go on that front.
104

104

00:05:27,260  -->  00:05:29,830
You can double check with all the other packages that you
105

105

00:05:29,840  -->  00:05:31,060
have them properly installed.
106

106

00:05:31,990  -->  00:05:33,110
Moving on.
107

107

00:05:33,120  -->  00:05:35,180
We can go on to building the bridge from source.
108

108

00:05:35,780  -->  00:05:38,810
So earlier we installed ROS2 from source.
109

109

00:05:39,080  -->  00:05:42,110
And so in order to utilize it, we actually have to make sure
110

110

00:05:42,120  -->  00:05:45,340
that we skip the ROS1 bridge command on build initially.
111

111

00:05:45,350  -->  00:05:47,980
So I'll go ahead and do that now in a new terminal.
112

112

00:06:03,560  -->  00:06:07,190
So here you are seeing we're rebuilding the ROS2 installation,
113

113

00:06:07,310  -->  00:06:10,160
but this should go by a lot faster since we've already built
114

114

00:06:10,170  -->  00:06:10,730
it already.
115

115

00:06:10,910  -->  00:06:13,820
This time we're just simply skipping the ROS1 bridge.
116

116

00:06:14,060  -->  00:06:16,280
That took 20 minutes or so.
117

117

00:06:16,290  -->  00:06:19,910
We did have some standard error outputs from RQT, GUI and
118

118

00:06:19,920  -->  00:06:21,290
RM Connect.
119

119

00:06:21,470  -->  00:06:24,140
I'm not going to be using Connect and I don't plan on using
120

120

00:06:24,150  -->  00:06:27,200
the RQT Gui, so I don't think this will affect us for right
121

121

00:06:27,210  -->  00:06:31,340
now. So I'm just going to continue on with the read me documentation
122

122

00:06:31,350  -->  00:06:32,930
for utilizing the ROS bridge.
123

123

00:06:33,180  -->  00:06:36,930
So now we need to source our ROS1 environment.
124

124

00:06:37,680  -->  00:06:44,640
We will do source/opt/ros/noetic/setup.bash
125

125

00:06:44,650  -->  00:06:53,700
ROS2 installation which is located here in my
126

126

00:06:53,710  -->  00:06:54,720
workspace directory.
127

127

00:06:54,720  -->  00:06:58,110
So I'll do source install setup bash.
128

128

00:07:00,490  -->  00:07:04,460
So I'll mention that the distribution was Noetic before.
129

129

00:07:04,850  -->  00:07:07,310
That's fine, because that's what indeed we were doing.
130

130

00:07:07,320  -->  00:07:10,370
We had our ROS1 source, and then now we just source our
131

131

00:07:10,380  -->  00:07:11,570
ROS Fox installation.
132

132

00:07:11,930  -->  00:07:16,190
Now we can build the ROS1 bridge using this command.
133

133

00:07:17,410  -->  00:07:22,280
So this will only rebuild the ROS1 bridge package so
134

134

00:07:22,290  -->  00:07:24,950
it won't rebuild the whole ROS2 installation.
135

135

00:07:24,960  -->  00:07:26,270
So we'll go ahead and run this.
136

136

00:07:28,710  -->  00:07:29,710
Alright.
137

137

00:07:29,720  -->  00:07:31,630
So our ROS1 bridge finished building.
138

138

00:07:31,640  -->  00:07:33,280
That took about eight minutes for me.
139

139

00:07:33,880  -->  00:07:36,910
So I we'll go through and try to run some examples.
140

140

00:07:37,120  -->  00:07:42,370
So I'll go ahead and open up new terminals that are independent
141

141

00:07:42,380  -->  00:07:44,200
of this one, since this one has both of them.
142

142

00:07:44,210  -->  00:07:46,570
sourced, I'll put this one away.
143

143

00:07:46,660  -->  00:07:50,950
So the first one I'll do is source this terminal to have
144

144

00:07:50,960  -->  00:07:54,250
only ROS1 to imitate my previous robot or system which
145

145

00:07:54,260  -->  00:08:00,670
only ran ROS1 code, such as sources opt ROS noetic
146

146

00:08:01,240  -->  00:08:02,590
setup.bash
147

147

00:08:05,930  -->  00:08:08,910
And then we'll just run a roscore instance.
148

148

00:08:10,380  -->  00:08:13,840
Then for this example, we'll need another shell which has
149

149

00:08:13,850  -->  00:08:17,220
ROS1 and then ROS2 source, which pretty much makes
150

150

00:08:17,230  -->  00:08:19,410
up the previous terminal we had and did our installation.
151

151

00:08:19,420  -->  00:08:20,790
So I'm going to bring that one back.
152

152

00:08:22,660  -->  00:08:26,540
And what we're going to do is export the ROS Master URI
153

153

00:08:26,660  -->  00:08:30,620
to match that of the local host or in this case, what this
154

154

00:08:30,630  -->  00:08:31,520
URI should be.
155

155

00:08:31,720  -->  00:08:34,960
So we can go ahead and export that.
156

156

00:08:35,419  -->  00:08:38,659
And now we can try run the ROS2 bridge.
157

157

00:08:41,039  -->  00:08:42,179
Alright.
158

158

00:08:42,190  -->  00:08:45,000
So here we can see that it created a bridge for the ROS
159

159

00:08:45,030  -->  00:08:46,950
out and RCL interface tags.
160

160

00:08:47,180  -->  00:08:49,610
Here I go and open a new terminal tab.
161

161

00:08:50,120  -->  00:08:55,670
Source opt ROS Noetic, setup.bash ROS topic list.
162

162

00:08:56,160  -->  00:08:57,180
All right.
163

163

00:08:57,190  -->  00:09:00,720
So we see that it converted our ROS out from ROS1, to ROS2
164

164

00:09:00,730  -->  00:09:03,720
Alright, so now we can go ahead and actually start some
165

165

00:09:03,730  -->  00:09:06,780
notes. For this example, we'll need another terminal which
166

166

00:09:06,790  -->  00:09:09,390
has our ROS1 source, which I just did here.
167

167

00:09:09,560  -->  00:09:12,650
I should go ahead and clear the screen and we'll go ahead
168

168

00:09:12,650  -->  00:09:15,350
and run talker node from the tutorials.
169

169

00:09:15,660  -->  00:09:20,700
So here we see these "Hello Worlds" publishing out.
170

170

00:09:20,700  -->  00:09:24,300
And now I can go ahead and open up another ROS2 instance.
171

171

00:09:24,310  -->  00:09:25,920
So this one has our ROS bridge running.
172

172

00:09:25,930  -->  00:09:29,210
So I'm going to open up another terminal tab and I'm going
173

173

00:09:29,220  -->  00:09:34,100
to source our install setup bash file.
174

174

00:09:35,990  -->  00:09:38,910
And then we can do our listener node.
175

175

00:09:39,100  -->  00:09:40,120
Okay.
176

176

00:09:43,050  -->  00:09:46,450
And here we can see we are receiving the "Hello World" messages
177

177

00:09:46,630  -->  00:09:47,800
from ROS version one.
178

178

00:09:47,810  -->  00:09:50,490
In this case, Noetic ROS2 Foxy.
179

179

00:09:51,780  -->  00:09:53,100
So there you go.
180

180

00:09:53,110  -->  00:09:56,360
That's how you can utilize the ROS bridge to bridge over
181

181

00:09:56,360  -->  00:10:00,200
perhaps old nodes that you had made in ROS1, and then
182

182

00:10:00,210  -->  00:10:02,390
you can implement them into ROS2 nodes.
183

183

00:10:02,880  -->  00:10:04,230
I'll go ahead and stop these.
184

184

00:10:08,560  -->  00:10:09,680
That's it.
185

185

00:10:09,690  -->  00:10:12,050
For this part of the video, I will do a second part of the
186

186

00:10:12,060  -->  00:10:16,050
video where I will do cross device communication using the
187

187

00:10:16,060  -->  00:10:16,590
ROS bridge.
188

188

00:10:18,060  -->  00:10:19,780
Alright, so here we are.
189

189

00:10:19,790  -->  00:10:22,900
I have two different computers going right now that are connected
190

190

00:10:22,910  -->  00:10:25,150
to each other via an Ethernet switch.
191

191

00:10:25,460  -->  00:10:29,720
So the first one is our original computer, which is running
192

192

00:10:29,730  -->  00:10:33,740
our ubuntu 20, where we have our ROS2 Foxy installed
193

193

00:10:33,750  -->  00:10:34,790
as well as ROS1.
194

194

00:10:34,800  -->  00:10:38,350
Noetic, on the second computer, we have a laptop of mine
195

195

00:10:38,360  -->  00:10:40,030
that's running Ubuntu 18.
196

196

00:10:40,240  -->  00:10:42,010
And this one is running ROS Melodic.
197

197

00:10:42,040  -->  00:10:44,980
So starting off with my laptop, I can go ahead and open up
198

198

00:10:44,990  -->  00:10:46,750
a terminal here just to show this to you.
199

199

00:10:46,760  -->  00:10:51,990
If I go over and do ROS version -d, as you can see, I'm running
200

200

00:10:52,000  -->  00:10:56,540
Melodic. And if I were to do ROS2 help, you can see that
201

201

00:10:56,550  -->  00:10:58,070
I do not have ROS2 install.
202

202

00:10:58,520  -->  00:11:01,100
All right, so that's the first thing to note.
203

203

00:11:01,110  -->  00:11:03,740
The second thing to note when working with two different
204

204

00:11:03,750  -->  00:11:06,230
systems is that each one will have its own independent IP
205

205

00:11:06,290  -->  00:11:09,710
address, either by you setting it or by a router setting
206

206

00:11:09,720  -->  00:11:13,550
it. So I can check that by running the IF Config command.
207

207

00:11:13,700  -->  00:11:18,040
And so here we can see my IP address for this computer is
208

208

00:11:18,160  -->  00:11:25,120
192.168.50.177, so all my other local computers that are
209

209

00:11:25,130  -->  00:11:29,090
on this network can't communicate with this computer by locating
210

210

00:11:29,100  -->  00:11:30,260
this IP address.
211

211

00:11:30,440  -->  00:11:34,370
So we can do the same thing over here on my Ubuntu 20 machine.
212

212

00:11:34,380  -->  00:11:38,690
So if I go over here and I type in If Config, you can see
213

213

00:11:38,700  -->  00:11:45,160
this machine has an IP address of 192.168.50.3
214

214

00:11:45,490  -->  00:11:48,850
So be wary of what your machines IP addresses are, because
215

215

00:11:48,860  -->  00:11:51,730
they will vary from mine if you are trying to reproduce what
216

216

00:11:51,740  -->  00:11:52,660
I'm about to do here.
217

217

00:11:52,700  -->  00:11:53,660
All right.
218

218

00:11:53,670  -->  00:11:57,440
So heading back to my machine running Ubuntu 18, I can go
219

219

00:11:57,450  -->  00:11:58,670
ahead and clear the screen.
220

220

00:11:58,670  -->  00:12:00,740
So this will be running our ROS1 instance.
221

221

00:12:00,750  -->  00:12:03,500
And we'll be simulating essentially that this is one of our
222

222

00:12:03,510  -->  00:12:05,120
robots running a ROS1 node.
223

223

00:12:05,130  -->  00:12:07,880
And then we want our Ubuntu 20 machine which has ROS2
224

224

00:12:07,890  -->  00:12:10,580
and ROS1 installed to be able to communicate with this
225

225

00:12:10,590  -->  00:12:13,400
one. And so we don't want to have to install ROS2 in this
226

226

00:12:13,410  -->  00:12:15,350
machine. So we're going to go through how we can go about
227

227

00:12:15,360  -->  00:12:15,740
doing that.
228

228

00:12:15,750  -->  00:12:18,650
If we have an older robot that we developed code for, we
229

229

00:12:18,660  -->  00:12:22,160
can still utilize it with newer machines that run ROS2.
230

230

00:12:22,600  -->  00:12:25,960
So the first thing to note, whenever we're dealing with ROS
231

231

00:12:25,960  -->  00:12:30,490
networking, we have to set ROS master URI and the ROS IP
232

232

00:12:30,550  -->  00:12:31,180
of the device.
233

233

00:12:31,190  -->  00:12:33,250
So I've gone ahead and listed these down.
234

234

00:12:33,250  -->  00:12:33,520
Right.
235

235

00:12:33,530  -->  00:12:36,520
So we just took note of the IP address, and I'll put it back
236

236

00:12:36,530  -->  00:12:37,000
up on here.
237

237

00:12:37,010  -->  00:12:37,990
IF config.
238

238

00:12:38,140  -->  00:12:42,430
All right, so this one is 192.168.50.177
239

239

00:12:42,580  -->  00:12:46,570
So in ROS1, there was a central ROS Master server, which
240

240

00:12:46,580  -->  00:12:48,730
all the ROS nodes would have to communicate with.
241

241

00:12:48,740  -->  00:12:51,040
I will have that set running on this computer.
242

242

00:12:51,280  -->  00:12:56,160
So what I will do is set my ROS Master URI by using the
243

243

00:12:56,170  -->  00:13:00,960
export command, and I will set it to all set up to https
244

244

00:13:01,740  -->  00:13:06,680
this IP address, and then Port 11 3 11, which is a default
245

245

00:13:06,680  -->  00:13:08,240
Port ROS1 runs off of.
246

246

00:13:08,260  -->  00:13:10,090
So I'll go ahead and run that.
247

247

00:13:10,100  -->  00:13:14,230
Then I'm going to set the ROS IP of this particular device,
248

248

00:13:14,740  -->  00:13:17,140
which is just the IP address part.
249

249

00:13:17,150  -->  00:13:20,380
So you don't need the Http, and you don't need the Port number
250

250

00:13:20,390  -->  00:13:21,130
at the end of it.
251

251

00:13:21,140  -->  00:13:25,270
And so with that, now, this knows that the ROS Master should
252

252

00:13:25,280  -->  00:13:28,900
be running on this machine on Port 11 3 11, because this
253

253

00:13:28,910  -->  00:13:31,180
is the machine with this particular IP address.
254

254

00:13:31,760  -->  00:13:35,540
So now we can go ahead and start our ROS Master for ROS
255

255

00:13:35,550  -->  00:13:36,920
one using ROS Core.
256

256

00:13:37,840  -->  00:13:41,090
Okay, so now we have a roscore instance running.
257

257

00:13:41,100  -->  00:13:42,620
So our ROS Melodic is running.
258

258

00:13:42,840  -->  00:13:46,080
So now if we go over to our one to 20 machine, we can run
259

259

00:13:46,090  -->  00:13:48,840
through the first example from the ROS1 bridge documentation
260

260

00:13:48,850  -->  00:13:49,980
in a very similar way.
261

261

00:13:50,280  -->  00:13:54,470
So right now, our shell A, which is ROS1 only, is that
262

262

00:13:54,480  -->  00:13:57,200
Ubuntu 18 computer that I just ran roscore on.
263

263

00:13:57,360  -->  00:14:00,270
So that only has ROS Melodic on it, and it's now running
264

264

00:14:00,280  -->  00:14:00,840
roscore.
265

265

00:14:01,350  -->  00:14:03,870
So now this will be our shell B.
266

266

00:14:03,880  -->  00:14:05,460
So we first source ROS1.
267

267

00:14:05,460  -->  00:14:08,100
In this case, I don't have melodic, but I have Noetic, but
268

268

00:14:08,110  -->  00:14:10,350
this will still work, even though it's a different distribution.
269

269

00:14:10,360  -->  00:14:14,090
So if I go ahead and run this source command right here,
270

270

00:14:14,100  -->  00:14:17,570
I am sourcing my Noetic setup bash where I installed it.
271

271

00:14:17,580  -->  00:14:21,500
Okay, so now my ROS Noetic is sourced for this terminal.
272

272

00:14:21,510  -->  00:14:24,740
Then we'll go ahead and source our ROS2 instance, which
273

273

00:14:24,750  -->  00:14:28,100
I also have here because I built ROS2 from source.
274

274

00:14:28,110  -->  00:14:31,610
So I have it here in my workspace folder, ROS2 Foxy, and
275

275

00:14:31,620  -->  00:14:33,020
then install setup bash.
276

276

00:14:33,300  -->  00:14:36,690
And so we got a little warning here saying set to Noetic
277

277

00:14:36,700  -->  00:14:37,680
before, please make sure.
278

278

00:14:37,690  -->  00:14:38,820
But that's totally fine.
279

279

00:14:38,830  -->  00:14:40,680
So for now, I'm just going to clear the screen.
280

280

00:14:40,840  -->  00:14:46,270
And now we need to export the ROS Master URI and our ROS
281

281

00:14:46,300  -->  00:14:48,610
IP address to match what it's supposed to be.
282

282

00:14:48,610  -->  00:14:52,090
So first off, we'll set the ROS Master URI.
283

283

00:14:52,090  -->  00:14:54,550
So the same thing we just set it to on the other computer.
284

284

00:14:54,560  -->  00:14:54,790
Right.
285

285

00:14:54,800  -->  00:14:58,250
So the ROS Master is running on the open to 18 computer,
286

286

00:14:58,520  -->  00:14:59,990
which has this IP address.
287

287

00:15:00,000  -->  00:15:02,870
So this will be our Master URI we want to communicate with.
288

288

00:15:02,880  -->  00:15:05,570
And then, as we mentioned, if I type in is config.
289

289

00:15:06,170  -->  00:15:06,410
Right.
290

290

00:15:06,660  -->  00:15:09,600
This is the IP address for this specific computer.
291

291

00:15:09,610  -->  00:15:13,530
So I'm going to export the ROS IP variable here in my terminal
292

292

00:15:13,660  -->  00:15:16,900
so that it knows that this is the ROS IP of this machine.
293

293

00:15:17,380  -->  00:15:19,840
Cool that I can go ahead and clear the screen.
294

294

00:15:19,840  -->  00:15:22,780
And now we can run ROS bridge.
295

295

00:15:23,620  -->  00:15:26,860
So if I go ahead and run this ROS2 run ROS1 bridge
296

296

00:15:27,220  -->  00:15:31,180
dynamic bridge, you can go ahead and run it, and you can
297

297

00:15:31,190  -->  00:15:34,000
see it created the bridge, and it's already beginning to
298

298

00:15:34,010  -->  00:15:35,140
convert those messages.
299

299

00:15:35,650  -->  00:15:39,940
Now we can actually open up another terminal to follow through
300

300

00:15:39,950  -->  00:15:40,660
with this example.
301

301

00:15:40,670  -->  00:15:43,360
And we will open this up on our Ubuntu 18 machine.
302

302

00:15:43,370  -->  00:15:45,430
And this will be our talker note that comes with just the
303

303

00:15:45,440  -->  00:15:47,500
normal ROS Py tutorials for ROS1.
304

304

00:15:47,940  -->  00:15:50,010
So I'll go ahead and do that now.
305

305

00:15:50,020  -->  00:15:51,120
So I'll control alt T.
306

306

00:15:51,150  -->  00:15:53,310
So now I have a new terminal here.
307

307

00:15:53,520  -->  00:15:56,010
And just to make sure again, just to prove to you that this
308

308

00:15:56,020  -->  00:15:57,600
is only source with this ROS melodic.
309

309

00:15:57,610  -->  00:16:02,600
If I do, ROS version -d it says melodic. ROS2 help.
310

310

00:16:02,720  -->  00:16:05,510
And you can see I don't have ROS2 installed on this machine,
311

311

00:16:05,520  -->  00:16:07,220
so I'm not trying to pull anything here.
312

312

00:16:07,230  -->  00:16:09,440
This machine only has ROS1 on it.
313

313

00:16:09,800  -->  00:16:13,790
We will need to make sure, though, that we have our Master
314

314

00:16:13,790  -->  00:16:17,630
URI and IP properly set in every terminal.
315

315

00:16:17,640  -->  00:16:20,600
So normally you would set this in your bash RC file so that
316

316

00:16:20,610  -->  00:16:22,340
it runs every time you open a new terminal.
317

317

00:16:22,520  -->  00:16:24,950
But for right now, I'm just going to set this manually.
318

318

00:16:24,960  -->  00:16:27,500
Each time we open a new terminal, we will only be opening
319

319

00:16:27,510  -->  00:16:28,100
these terminals.
320

320

00:16:28,110  -->  00:16:28,970
This should be fine.
321

321

00:16:29,180  -->  00:16:32,210
And now we can go ahead and run our talker node.
322

322

00:16:32,500  -->  00:16:37,390
So here we can see the default Hello World messages are pointing
323

323

00:16:37,400  -->  00:16:38,050
to the screen.
324

324

00:16:38,290  -->  00:16:43,580
Now, if I go back to my ubuntu 20 machine, I can open up another
325

325

00:16:43,590  -->  00:16:46,220
shell that only needs to have ROS2 sourced on it.
326

326

00:16:46,230  -->  00:16:47,510
So I'll go ahead and do control alt T.
327

327

00:16:48,060  -->  00:16:50,010
And here's my second instance.
328

328

00:16:50,020  -->  00:17:00,390
And so I will source my ROS Foxy install, and we don't have
329

329

00:17:00,400  -->  00:17:01,440
to worry about the warning.
330

330

00:17:01,450  -->  00:17:04,140
And then if now I go ahead and run a listener.
331

331

00:17:04,150  -->  00:17:04,710
Right.
332

332

00:17:04,829  -->  00:17:07,530
So there are no talker nodes running on this machine the
333

333

00:17:07,540  -->  00:17:10,349
only talker node is running on the Ubuntu 18 machine.
334

334

00:17:10,800  -->  00:17:13,920
But because we have our bridge running here, we should be
335

335

00:17:13,930  -->  00:17:17,180
able to listen in on those messages over the network, because
336

336

00:17:17,190  -->  00:17:20,510
we set our ROS Master URI and our ROS IP address accordingly.
337

337

00:17:20,750  -->  00:17:24,369
Actually, that's actually what I need to do here.
338

338

00:17:24,380  -->  00:17:27,730
So before I go ahead and run that, I will need to set our
339

339

00:17:27,740  -->  00:17:31,180
ROS Master URI and our ROS IP in this terminal, since this
340

340

00:17:31,190  -->  00:17:33,840
is a new terminal, alright
341

341

00:17:33,870  -->  00:17:36,240
With that, now I can go ahead and run the listener.
342

342

00:17:38,790  -->  00:17:42,430
And here you can see the ROS bridge detects that message
343

343

00:17:42,490  -->  00:17:46,240
coming from the ROS2, and the ROS1 it bridges it.
344

344

00:17:46,250  -->  00:17:48,790
And here we can see I heard Hello World, which is matching
345

345

00:17:48,800  -->  00:17:52,310
with what is being sent from the Ubuntu 18 computer.
346

346

00:17:53,060  -->  00:17:53,360
Cool!
347

347

00:17:53,690  -->  00:17:55,850
And it's worth noting that this works both ways.
348

348

00:17:55,860  -->  00:17:58,220
So I'll go ahead and stop this listener node, and I'll stop
349

349

00:17:58,230  -->  00:17:59,570
the talker node on the other machine.
350

350

00:17:59,580  -->  00:18:02,720
I'll go ahead and clear the screen on both of these.
351

351

00:18:03,140  -->  00:18:05,750
But this also works from ROS2 to ROS1.
352

352

00:18:05,760  -->  00:18:08,930
So if you create any new nodes on your ROS2 instance
353

353

00:18:08,940  -->  00:18:11,980
that you want your ROS1 computer to Subscribe to, it
354

354

00:18:12,040  -->  00:18:13,000
works the same way.
355

355

00:18:13,010  -->  00:18:16,090
Instead of running the listener node this time, I can run
356

356

00:18:16,100  -->  00:18:16,960
the talker node.
357

357

00:18:18,190  -->  00:18:24,140
So if we say talker, we can see we're publishing Hello World.
358

358

00:18:24,150  -->  00:18:25,280
And then counter variable.
359

359

00:18:25,290  -->  00:18:27,860
That's what this version of talker looks like for ROS2.
360

360

00:18:28,280  -->  00:18:32,600
And now if I run the listener node on our own to 18 machine
361

361

00:18:33,020  -->  00:18:37,430
that is running only ROS1 the ROS bridge will show up,
362

362

00:18:37,440  -->  00:18:38,960
that it's bridging the communications.
363

363

00:18:38,970  -->  00:18:42,290
And we can see here that my ROS2 publishing Hello World
364

364

00:18:42,320  -->  00:18:45,280
is being received on my ROS1 machine, and it's receiving
365

365

00:18:45,290  -->  00:18:47,500
the Hello World messages just fine on the listener node.
366

366

00:18:47,500  -->  00:18:49,810
I can go ahead and stop this node.
367

367

00:18:50,500  -->  00:18:54,070
With that, you have successfully implemented use of the ROS2
368

368

00:18:54,070  -->  00:18:57,010
bridge so that you could bridge communications between
369

369

00:18:57,020  -->  00:18:59,080
ROS1 and ROS2 systems.
