1
00:00:00,060 --> 00:00:04,530
We have seen that our robot is now able to move in the simulation.

2
00:00:04,530 --> 00:00:07,320
We can drive it using tell your keyboard.

3
00:00:08,160 --> 00:00:15,390
What we want to do now is to drive it through a Python script because when we are going to move forward,

4
00:00:15,630 --> 00:00:22,440
our computer vision game is just going to send us command velocities and for command velocity.

5
00:00:22,440 --> 00:00:25,440
Interpretation into robot motion is very essential.

6
00:00:25,740 --> 00:00:31,920
For that we are going to create a node and I can write the code right away.

7
00:00:31,930 --> 00:00:38,640
But what I am going to do is to just create a file here and that is going to be named as driving dot

8
00:00:38,640 --> 00:00:41,910
by or I should say driving node.

9
00:00:42,870 --> 00:00:43,200
Okay.

10
00:00:43,560 --> 00:00:44,130
Kind of.

11
00:00:44,520 --> 00:00:55,590
But the interesting thing is I am going to get all of its code from Ros Vicky Ros to Subs Publisher

12
00:00:55,590 --> 00:00:59,760
in in this specific case, we need a publisher in Python.

13
00:01:01,810 --> 00:01:04,360
Right, a simple publisher and subscriber.

14
00:01:04,360 --> 00:01:07,460
And we are going to follow a simple structure.

15
00:01:07,480 --> 00:01:13,240
I'm showing you this because the very first time I learned from this was this last week.

16
00:01:13,660 --> 00:01:20,270
So coming to the point that we have our package, writing the publisher load, you can download it to

17
00:01:20,660 --> 00:01:23,890
the minimum publisher or you can get the code from here.

18
00:01:25,900 --> 00:01:32,860
So if I paste all of the available code here, the risk line library standard messages, string.

19
00:01:33,460 --> 00:01:34,120
Okay.

20
00:01:35,380 --> 00:01:42,610
There in basic format, there is a publisher of which is defined in this class and there is a timer

21
00:01:42,610 --> 00:01:43,600
callback back for that.

22
00:01:44,080 --> 00:01:50,030
Now the point is it is publishing a string message, but what we would be requiring is a different thing.

23
00:01:50,050 --> 00:01:51,040
How do I know that?

24
00:01:51,040 --> 00:01:51,880
Let me show you.

25
00:01:52,210 --> 00:02:01,330
If we have this terminal here and I bring my robot into that simulation that we want to, I perform

26
00:02:01,330 --> 00:02:07,300
ROS to topic list to get all of the available topics we have command velocity.

27
00:02:08,350 --> 00:02:11,230
That is the main topic that we were utilizing.

28
00:02:11,230 --> 00:02:22,390
So rice top rice to topic, get rice to info, rice to topic in full.

29
00:02:23,320 --> 00:02:28,180
I think that was the command to geometric message twist and there is no publisher.

30
00:02:28,210 --> 00:02:31,510
There is one subscriber available which is this robot.

31
00:02:31,510 --> 00:02:33,560
So geometric message twist.

32
00:02:34,000 --> 00:02:41,440
This is the main thing coming to the point that in our room what is the node?

33
00:02:42,370 --> 00:02:44,230
We want geometric message here.

34
00:02:44,260 --> 00:02:48,010
So if I bring it here and bring the code and decide.

35
00:02:49,660 --> 00:02:53,680
So we want to make tree message.

36
00:02:53,680 --> 00:03:01,570
Let me copy pasted geometric message start message and I want twist inside of and this is the message

37
00:03:01,570 --> 00:03:02,290
type we want.

38
00:03:02,470 --> 00:03:04,870
You can get information about this topic as well.

39
00:03:04,870 --> 00:03:08,410
So the topic is not topic, it is command velocity.

40
00:03:08,410 --> 00:03:16,300
I'm just adjusting the mean publisher of node that is available in rice Vicky and I want it to work

41
00:03:16,300 --> 00:03:21,490
for my requirements so the message it is going to be communicating is stressed.

42
00:03:21,640 --> 00:03:26,650
The topic is command velocity and you can call it every second.

43
00:03:26,650 --> 00:03:34,180
We are going to send not minimal publisher command and let's see just the velocity publisher.

44
00:03:34,180 --> 00:03:37,390
It is going to be publishing velocities, linear and angular.

45
00:03:37,930 --> 00:03:43,900
Now in timer callback, you are going to create a message of twist.

46
00:03:45,310 --> 00:03:51,880
And here comes the reality, which I am going to perform in a moment.

47
00:03:51,880 --> 00:04:00,430
First, I need to get information about the message type, cross to interface show and the message we

48
00:04:00,430 --> 00:04:02,020
want to get information about.

49
00:04:02,590 --> 00:04:02,770
Two.

50
00:04:02,770 --> 00:04:05,020
Previously we were using the standard message.

51
00:04:05,020 --> 00:04:09,040
Let's first get information about that standard message.

52
00:04:10,690 --> 00:04:14,050
And that was standard message string.

53
00:04:14,050 --> 00:04:17,830
Yes, this was the message that was in our node.

54
00:04:18,460 --> 00:04:22,480
It says there is only one entry and that is string data entry.

55
00:04:22,510 --> 00:04:23,670
You can pass the string.

56
00:04:23,680 --> 00:04:32,260
Okay, now we are going to be using the same no practice to get information about our geometric message

57
00:04:32,260 --> 00:04:37,150
twist, which is the most common velocity message utilized.

58
00:04:37,450 --> 00:04:44,110
This contains a linear and an angular vector, so we need to get information about the interface of

59
00:04:44,110 --> 00:04:44,710
vector.

60
00:04:45,880 --> 00:04:47,650
Let's get into it.

61
00:04:47,890 --> 00:04:57,580
Vector does vector contains its own type or is it something else or is a geometric message vector?

62
00:04:57,580 --> 00:05:02,110
I'm showing you just to give you an idea how you can search about things.

63
00:05:02,110 --> 00:05:05,680
So it is also a geometric message to geometric message.

64
00:05:05,890 --> 00:05:13,300
Vector contains X-Y-Z three different values of load for linear and three different values for Angular.

65
00:05:13,600 --> 00:05:20,320
In our case, what we are going to be only interested in is linear X and angular z.

66
00:05:20,410 --> 00:05:22,150
So let's start writing about it.

67
00:05:22,540 --> 00:05:36,490
Message dot linear dot x is equal to 0.5 and message start angular z is equal to 0.3.

68
00:05:37,960 --> 00:05:39,820
Just to give a rotational angle.

69
00:05:40,120 --> 00:05:42,370
I will not be giving both at the same time.

70
00:05:42,370 --> 00:05:48,940
I'm just going to give linear for now and you are going to publish the message and do not log the data.

71
00:05:48,940 --> 00:05:54,370
We just need we don't need to integrate that as we'll just publish the data and the report is going

72
00:05:54,370 --> 00:05:58,570
to move in linear X with 0.5 velocity.

73
00:05:59,170 --> 00:05:59,830
That's it.

74
00:05:59,830 --> 00:06:00,370
We.

75
00:06:00,530 --> 00:06:04,790
You need to make this run on our system.

76
00:06:04,790 --> 00:06:08,860
For that we need to open setup by file in setup by file.

77
00:06:08,870 --> 00:06:20,480
If we open up the Google Chrome page of Wikipedia for Ros, you can see it entered and we need to add

78
00:06:20,480 --> 00:06:32,150
this specific line into our setup dot by file of our package so it knows where this executable node

79
00:06:32,150 --> 00:06:35,630
is sort of path setting.

80
00:06:35,630 --> 00:06:45,860
So we have this of package of maze board and the name of our node that I want to execute is Driving

81
00:06:45,860 --> 00:06:46,190
Node.

82
00:06:46,730 --> 00:06:51,470
What is going to be the name of an executable it will generate?

83
00:06:51,470 --> 00:06:59,060
I want it to be driving a driving maze board that is that is going to be available to us.

84
00:06:59,510 --> 00:07:02,030
Now all of the things are set up.

85
00:07:03,680 --> 00:07:08,030
Let's compile it and see how does it performs.

86
00:07:10,700 --> 00:07:12,610
Let's open up this as well.

87
00:07:14,350 --> 00:07:15,880
Now it is this.

88
00:07:16,060 --> 00:07:16,480
Yes.

89
00:07:16,750 --> 00:07:26,200
So let's go into our directory of ROS to part planning workspace.

90
00:07:26,200 --> 00:07:27,940
Now we are inside of our workspace.

91
00:07:28,300 --> 00:07:40,180
Perform call can be and I will perform allow overriding and the package name is Ms. bought.

92
00:07:44,000 --> 00:07:45,590
It's me and the scoreboard.

93
00:07:45,740 --> 00:07:49,490
Have I had it in the same name in the set of the world?

94
00:07:50,300 --> 00:07:50,810
Nope.

95
00:07:51,470 --> 00:07:53,390
It would not have appeared.

96
00:07:54,320 --> 00:07:56,690
You don't have to make such mistakes.

97
00:07:56,720 --> 00:08:07,370
Things are not going to want rice to run maize board and the name of the node was driving.

98
00:08:08,030 --> 00:08:08,840
Is it coming?

99
00:08:09,380 --> 00:08:10,670
Driving mes.

100
00:08:10,670 --> 00:08:14,210
But I'm pressing dab and it automatically completes.

101
00:08:14,220 --> 00:08:17,660
Let's see if our robot is moving in linear x or not.

102
00:08:18,410 --> 00:08:30,020
So you can see a robot is moving in linear x and basically what our achievement is, our node is publishing

103
00:08:30,020 --> 00:08:32,450
velocity that is controlling the robot.

104
00:08:32,450 --> 00:08:35,570
We are not driving it through our keyboard.

105
00:08:35,990 --> 00:08:45,710
Now let's send these velocity, which is some strong angular rotation, very less linear rotation.

106
00:08:46,130 --> 00:08:52,000
I am going to again perform at the stop this node first and give this up.

107
00:08:52,610 --> 00:09:02,210
Build it again and hold this robot and bring it back to this specific point.

108
00:09:03,140 --> 00:09:05,390
And now I am going to.

109
00:09:08,120 --> 00:09:16,280
Yes, run this node again and see if the robot starts to make anticlockwise rotation or not.

110
00:09:16,670 --> 00:09:23,660
Yes, it is making anticlockwise rotation because the linear, the angular velocity is positive.

111
00:09:23,660 --> 00:09:29,260
So it is counterclockwise when it is positive and the linear velocity is also sent.

112
00:09:29,510 --> 00:09:37,670
If I only send the angular velocity, the robot is just going to stop at 1.2 and rotate.

113
00:09:37,670 --> 00:09:40,340
But as the linear velocity is, there it is.

114
00:09:41,170 --> 00:09:43,130
Are they making a circle?

115
00:09:43,130 --> 00:09:43,700
Sort of.

116
00:09:44,090 --> 00:09:44,910
So that was it.

117
00:09:44,930 --> 00:09:45,650
I'm driving.

118
00:09:45,650 --> 00:09:46,460
Node is ready.

119
00:09:46,880 --> 00:09:48,740
What else do we need to do?

120
00:09:48,770 --> 00:09:50,240
We have to look further.

121
00:09:50,270 --> 00:09:53,920
What are the what are the important nodes we need to build?

122
00:09:53,930 --> 00:09:56,360
We talk about that and we will build them.
