1
00:00:05,450 --> 00:00:11,060
Now we are going to write the code for the subscriber and we are not going to write.

2
00:00:11,300 --> 00:00:12,920
Someone else is going to write.

3
00:00:13,540 --> 00:00:14,960
Yeah, this chibitty.

4
00:00:15,740 --> 00:00:18,800
You can use Chat Liberty to write your code.

5
00:00:18,850 --> 00:00:21,890
You can get rid of this struggle of writing the code.

6
00:00:21,890 --> 00:00:25,850
You can just tell chettipatti and get what you want.

7
00:00:26,420 --> 00:00:27,830
Okay, we will do that.

8
00:00:27,860 --> 00:00:40,310
We will say to church to write the rows to ship string subscriber or cord hit enter.

9
00:00:50,060 --> 00:00:56,510
The one thing that you need to understand about our subscriber subscriber will be called whenever it

10
00:00:56,510 --> 00:01:03,050
receives data and there will be a callback function that will be called whenever the subscriber receives

11
00:01:03,050 --> 00:01:03,770
the data.

12
00:01:03,770 --> 00:01:08,000
And then you can do your further processing.

13
00:01:08,000 --> 00:01:10,340
So it has provided us the code.

14
00:01:10,370 --> 00:01:18,140
We will use this to open up our VS code in which we have already publisher and my node dot cpp file.

15
00:01:18,140 --> 00:01:29,510
We will just create another one new file subscriber dot js We have this and we will just copy and paste

16
00:01:29,510 --> 00:01:30,350
it here.

17
00:01:31,730 --> 00:01:32,200
All right.

18
00:01:32,210 --> 00:01:36,920
It has created the subscriber with a similar fashion, except you can see it here.

19
00:01:36,920 --> 00:01:44,360
Instead of using Create publisher, it has issues create subscriber and there is a callback function

20
00:01:44,360 --> 00:01:47,360
to string callback that is declared here.

21
00:01:47,390 --> 00:01:56,220
If this is just printing the information, explain the code line by line.

22
00:01:56,970 --> 00:02:01,830
It is going to solve all the problems that you can possibly have with the code.

23
00:02:03,240 --> 00:02:04,980
And there you go.

24
00:02:04,980 --> 00:02:06,900
It will explain everything.

25
00:02:07,020 --> 00:02:11,610
So we have our subscriber code here, but we cannot use it.

26
00:02:11,640 --> 00:02:12,150
Why?

27
00:02:12,660 --> 00:02:18,570
Because we have to tell that we have created a node to the package.

28
00:02:18,570 --> 00:02:24,270
How we do that, we mention it in package XML file and cmakelists.

29
00:02:24,960 --> 00:02:25,410
Okay.

30
00:02:25,410 --> 00:02:28,860
And the package XML will declare the dependencies.

31
00:02:28,860 --> 00:02:35,940
So it is dependent on the messages that we have already declared.

32
00:02:35,940 --> 00:02:36,870
So that's it.

33
00:02:36,870 --> 00:02:43,740
We will not edit anything in the package XML file, but we will go to the cmake list and there we will

34
00:02:43,740 --> 00:02:45,120
add a node.

35
00:02:46,170 --> 00:02:48,930
So we will just copy it here.

36
00:02:53,190 --> 00:02:53,790
First it.

37
00:02:55,980 --> 00:02:57,840
Fuel cell listener.

38
00:03:02,610 --> 00:03:09,060
And then the pot is a shark and the file name is subscriber.

39
00:03:12,070 --> 00:03:13,480
Listener Nordeney.

40
00:03:14,110 --> 00:03:18,250
And it depends on our messages.

41
00:03:18,280 --> 00:03:24,820
In the installed, we will just write the name of the node, which is listener.

42
00:03:30,220 --> 00:03:30,690
Yes.

43
00:03:31,050 --> 00:03:33,240
And now we will try to build it.

44
00:03:35,830 --> 00:03:36,850
The court is filled.

45
00:03:39,550 --> 00:03:40,030
Source.

46
00:03:40,420 --> 00:03:43,150
Install local setup source workspace.

47
00:03:43,150 --> 00:03:48,430
And now we will run the subscriber ros to run turtle.

48
00:03:48,700 --> 00:03:52,420
Same for and press double tab.

49
00:03:53,170 --> 00:04:01,480
Now it is offering three nodes so we will just write listener and hit enter.

50
00:04:02,320 --> 00:04:06,700
So now the node is running and we will see Ros topic.

51
00:04:08,350 --> 00:04:10,570
And now we see there is our topic.

52
00:04:10,600 --> 00:04:12,280
Today's topic name.

53
00:04:12,280 --> 00:04:14,770
And this is our the name of the subscriber.

54
00:04:14,770 --> 00:04:19,570
But in the publisher the topic name was just topic.

55
00:04:19,600 --> 00:04:26,500
We will just try to modify both of the topics and we will give them a common name in order to set their

56
00:04:26,500 --> 00:04:27,460
communication.

57
00:04:27,820 --> 00:04:35,650
Remember, if we want a publisher and subscriber communicate, there should be a common topic with the

58
00:04:35,650 --> 00:04:36,400
same name.

59
00:04:36,400 --> 00:04:38,470
Okay, come here to the publisher.

60
00:04:38,470 --> 00:04:41,800
And there is the topic, which is topic trained.

61
00:04:46,810 --> 00:04:48,050
Message.

62
00:04:50,180 --> 00:04:53,400
Commission me question.

63
00:04:54,470 --> 00:04:57,500
Okay, so this is our topic name.

64
00:04:57,500 --> 00:05:00,290
Now save it.

65
00:05:00,290 --> 00:05:01,970
And also come here.

66
00:05:01,970 --> 00:05:04,790
And this is the subscriber topic.

67
00:05:05,480 --> 00:05:08,150
Okay, so now we will build it again.

68
00:05:11,400 --> 00:05:15,030
And now we will run our subscriber.

69
00:05:15,870 --> 00:05:19,560
And now we will check the name of the topic.

70
00:05:20,130 --> 00:05:21,540
And there we go.

71
00:05:21,780 --> 00:05:23,550
String message communication.

72
00:05:23,700 --> 00:05:29,340
Okay, So currently it is not showing any data because there is no publisher.

73
00:05:29,340 --> 00:05:38,040
But we are going to we will just open another terminal source, install local setup dot bash.

74
00:05:38,460 --> 00:05:44,760
And now the terminal is sourced and it knows we have a workspace called Ros Workspace.

75
00:05:44,970 --> 00:05:51,960
And now we will run the Ros to run turtle same port.

76
00:05:52,200 --> 00:05:59,910
And then the publisher, which was Docker and it is publishing the data, hopefully.

77
00:05:59,910 --> 00:06:01,550
And there you go.

78
00:06:01,560 --> 00:06:02,190
It is.

79
00:06:02,780 --> 00:06:05,510
And we can also check it from here.

80
00:06:05,820 --> 00:06:09,980
Rose to topic equal.

81
00:06:12,120 --> 00:06:16,650
Topping name, and it is also receiving the data here.

82
00:06:17,310 --> 00:06:17,850
Okay.

83
00:06:18,240 --> 00:06:21,010
And press control C to kill it.

84
00:06:21,030 --> 00:06:25,740
And now we will see the connection using our equity graph.

85
00:06:25,990 --> 00:06:28,620
Arc underscore graph.

86
00:06:36,930 --> 00:06:37,310
Okay.

87
00:06:37,320 --> 00:06:38,610
The notes are minimal.

88
00:06:38,610 --> 00:06:43,680
Publisher and the string subscriber and the topic name is String message communication.
