1
00:00:00,750 --> 00:00:06,450
His duty, a round of applause for everyone following other targets that we achieve in the three stages

2
00:00:06,450 --> 00:00:07,800
that we have completed so far.

3
00:00:08,340 --> 00:00:10,890
We extracted information from our environment.

4
00:00:10,980 --> 00:00:14,130
The first two stages of localization and mapping.

5
00:00:14,820 --> 00:00:19,770
Then we computed the path to go based on that information, in part planning.

6
00:00:20,490 --> 00:00:25,440
Now, in the current coding session, we will be implementing the last bit of robot navigation, which

7
00:00:25,440 --> 00:00:27,200
is motion planning here.

8
00:00:27,540 --> 00:00:32,070
We will be planning about the robot motion or navigation which will take it to the music.

9
00:00:33,230 --> 00:00:38,000
To implement the last stage of motion planning, we will be creating a new file inside the Ms. Vault

10
00:00:38,000 --> 00:00:38,480
folder.

11
00:00:39,550 --> 00:00:41,320
That we name bought.

12
00:00:42,640 --> 00:00:47,080
Motion planning not by and incited.

13
00:00:47,290 --> 00:00:48,910
We perform the necessary inputs.

14
00:00:49,780 --> 00:00:54,490
These are the inputting of Siri to number it in math libraries.

15
00:00:54,910 --> 00:00:56,290
Then we create the class.

16
00:00:57,250 --> 00:01:03,460
I've bought a motion planner that didn't perform the actual tasks of motion planning inside of it.

17
00:01:04,060 --> 00:01:08,410
Then we define the instance variable for this particular class, and that can be done by defining the

18
00:01:08,410 --> 00:01:09,430
initialization function.

19
00:01:10,600 --> 00:01:14,260
And inside it we define the first few sets of instance variable.

20
00:01:15,220 --> 00:01:21,760
These are the first is basically a counter that counts the number of iterations that has elapsed since

21
00:01:21,760 --> 00:01:23,080
the motion planner has begun.

22
00:01:23,680 --> 00:01:30,220
Then we have the state variable or instance variable that basically keeps track of whether the initial

23
00:01:30,220 --> 00:01:31,510
point has been taken or not.

24
00:01:31,900 --> 00:01:35,200
This initial point is basically the car's initial location.

25
00:01:35,440 --> 00:01:41,590
Once the motion planner has begun and then we have the actual container that will store the initial

26
00:01:41,590 --> 00:01:42,430
location of the car.

27
00:01:42,640 --> 00:01:44,320
Once we start the motion planner.

28
00:01:46,100 --> 00:01:51,530
Then we define a new state variable that basically keeps track of whether the relationship of the end

29
00:01:51,530 --> 00:01:55,710
goal for the image and the simulation has been computed or not.

30
00:01:56,270 --> 00:01:59,630
So as this is the initialize and states, this is set to false.

31
00:02:00,830 --> 00:02:04,260
Then we define the three containers that stores the most angle.

32
00:02:04,400 --> 00:02:06,530
The first is the angle in image.

33
00:02:06,830 --> 00:02:12,460
Then we have the what angle in simulation, and then we have the relationship between for the what angle

34
00:02:12,650 --> 00:02:14,530
in image and simulation.

35
00:02:15,480 --> 00:02:21,270
So once we have defined these instances variable for our motion planner class, we go back and create

36
00:02:21,270 --> 00:02:27,990
the actual function that we call or perform the bot navigation for our robot and that will be named

37
00:02:27,990 --> 00:02:29,520
as navigate forth.

38
00:02:30,210 --> 00:02:32,070
So this takes in four input arguments.

39
00:02:32,070 --> 00:02:37,320
The first is the location of the robot or the current location of the robot provided by the local date.

40
00:02:37,740 --> 00:02:43,170
Then we have the bot controlled by the bot planning stage and then we have the velocity object that

41
00:02:43,170 --> 00:02:44,820
stores the velocity components.

42
00:02:45,030 --> 00:02:47,700
That includes the linear velocity and angular velocity.

43
00:02:47,970 --> 00:02:51,990
And then we have the publisher that will publish the velocity once we have modified it.

44
00:02:52,800 --> 00:02:58,230
So we proceed further and start by checking for the counter whether the count or self self-doubt column.

45
00:03:01,270 --> 00:03:02,610
It's great and then 20 or not.

46
00:03:03,060 --> 00:03:07,140
So obviously at the start we have initialize the counter to be zero.

47
00:03:07,290 --> 00:03:08,700
So it is less than 20.

48
00:03:09,000 --> 00:03:10,410
So this would not get true.

49
00:03:10,650 --> 00:03:20,460
So if this goes through, we basically just set our velocity object linear component in extraction 2010

50
00:03:20,610 --> 00:03:22,500
basically telling our car to stop.

51
00:03:22,890 --> 00:03:25,950
So if it is less than 20, what would we do?

52
00:03:26,220 --> 00:03:27,810
We want to move our car.

53
00:03:28,200 --> 00:03:35,040
So we defined that as condition when the counter is less than 20 or or at the start of the motion planet

54
00:03:35,460 --> 00:03:35,940
object.

55
00:03:36,420 --> 00:03:38,160
So here's what we would do.

56
00:03:38,400 --> 00:03:42,300
We will start with checking or extracting the initial location of our car.

57
00:03:42,660 --> 00:03:44,520
So we first check if the self taught.

58
00:03:45,790 --> 00:03:48,280
Initial point has been taken or accepted or not.

59
00:03:48,640 --> 00:03:52,030
So if it has not been extracted, we extracted the initial location of the car.

60
00:03:52,450 --> 00:04:00,580
So that can be done by simply storing initial location and setting this to the location that is provided

61
00:04:00,910 --> 00:04:02,770
as an argument of this function.

62
00:04:03,370 --> 00:04:09,460
Then once we have to get the initial location inside the initial location instance variable, we simply

63
00:04:09,460 --> 00:04:13,810
set the stage variable of point initial taken to true.

64
00:04:14,800 --> 00:04:21,400
And then we simply make our car move forward by setting the velocity object linear component.

65
00:04:22,670 --> 00:04:24,020
In the extraction.

66
00:04:25,960 --> 00:04:29,930
21.0, basically greater than zero, getting it to move forward.

67
00:04:30,550 --> 00:04:36,010
And that can be done by simply calling the velocity publisher, calling its function or publish.

68
00:04:39,260 --> 00:04:41,270
And passing in the velocity object.

69
00:04:41,780 --> 00:04:46,730
This basically moves the car until the counter is is less than 20.

70
00:04:47,090 --> 00:04:53,390
So we basically now see that increment the count on every iteration by one.

71
00:04:54,110 --> 00:05:00,710
So once this counter reaches or 20 or greater than 20, this as would not get to, but this condition

72
00:05:00,710 --> 00:05:01,310
would get to.

73
00:05:01,490 --> 00:05:07,400
And we set the velocity linear component in its direction to 0.0, basically stopping the car.

74
00:05:08,060 --> 00:05:11,330
So once this condition arrives, our counter is greater than 20.

75
00:05:11,600 --> 00:05:16,010
What happens is that we basically start by stopping our car.

76
00:05:17,750 --> 00:05:20,930
So we stop our car by using the velocity publisher.

77
00:05:22,670 --> 00:05:24,200
Calling is a function of public.

78
00:05:26,260 --> 00:05:32,140
And passing in the velocity object that we had just modified to 0.0 by the living component in the X

79
00:05:32,140 --> 00:05:32,620
direction.

80
00:05:33,310 --> 00:05:38,290
Now, once we have stopped our car, we can now compute the angle of our car in the image.

81
00:05:38,890 --> 00:05:43,390
Now that can be done by creating a new function, but computes the angle and distance of the car.

82
00:05:43,600 --> 00:05:49,060
Given the two points that are basically the initial location of the car that you extracted when we started

83
00:05:49,060 --> 00:05:51,820
the motion planning class and then the current location.

84
00:05:52,300 --> 00:05:53,620
So we create the new function.

85
00:05:54,010 --> 00:06:00,910
We go right up here, we create the new function that computes the angle and distance between two points.

86
00:06:01,330 --> 00:06:05,260
So this is just like the normal function that can be used to angular distance between two points.

87
00:06:05,620 --> 00:06:11,050
But just the difference here is that for the normal convention or for the simulation, we have the X

88
00:06:11,050 --> 00:06:16,930
increasing in the right direction and the Y axis increasing the positive or upward direction.

89
00:06:17,410 --> 00:06:23,920
But for the image where we are computing the angular and distance, for this case, our expression is

90
00:06:23,980 --> 00:06:27,040
like the original or normal convention, increasing the right.

91
00:06:27,310 --> 00:06:29,500
But the y axis is in reverse.

92
00:06:29,920 --> 00:06:31,990
It is increasing in the downward direction.

93
00:06:32,620 --> 00:06:39,010
So what we need to do, we need to perform or compute the same trigonometric roles to compute the distance

94
00:06:39,010 --> 00:06:41,230
and angle between two points for the image.

95
00:06:41,500 --> 00:06:44,680
We need to reverse the error for the y axis.

96
00:06:44,860 --> 00:06:50,560
And that can be done by simply subtracting the first point for the y axis with a second point of y axis

97
00:06:50,770 --> 00:06:52,030
and not vice versa.

98
00:06:52,360 --> 00:07:00,640
So basically for the error of by the point E is subtracted from or basically the point be subtracted

99
00:07:00,640 --> 00:07:01,480
from point eight.

100
00:07:02,410 --> 00:07:07,090
So point eight comes first and point we come after for the y axis.

101
00:07:07,510 --> 00:07:13,150
And this is how we compute the same distance and angle for the image and for the distance.

102
00:07:13,150 --> 00:07:18,310
We use the same Euclidean formula and for the angle we use the function of our time, two of the math

103
00:07:18,310 --> 00:07:25,390
library and our time to basically turns the angle between two points and in the form of degree or in

104
00:07:25,390 --> 00:07:26,300
the form of radians.

105
00:07:26,320 --> 00:07:31,150
So we need to convert it into degrees to perform consistency and frame of reference.

106
00:07:31,420 --> 00:07:33,250
So basically we get the angle in degrees.

107
00:07:33,550 --> 00:07:39,940
And because this outputs in the value or in the range of negative pi to positive Y and converting it

108
00:07:39,940 --> 00:07:45,700
to degrees, we get negative one, 80, one, 80, and we want it to the range of 0 to 360.

109
00:07:45,970 --> 00:07:54,940
We convert it from -1 to 182 0 to 360 by simply adding 60 to the negative degree angle values.

110
00:07:55,630 --> 00:07:56,890
So we do that right here.

111
00:07:57,010 --> 00:08:00,310
And what we get as an output is basically the angle between points.

112
00:08:01,260 --> 00:08:07,320
Not from negative one or 2 to 1, but from 0 to 3, 60 degrees, all positive.

113
00:08:07,500 --> 00:08:09,720
And then we also have the distance computer.

114
00:08:10,260 --> 00:08:15,000
So we have the distance computer and now we can call this function inside the navigate part function.

115
00:08:15,690 --> 00:08:22,090
Right after we have stopped the car by saying self dot and going to distance for the point, a provided

116
00:08:22,110 --> 00:08:27,240
the initial location of the car that is basically stored in the instance variable of init location and

117
00:08:27,240 --> 00:08:30,600
then for the current location we pass in the bar location.

118
00:08:31,650 --> 00:08:37,380
So once we provide this information, we have computed the two things, but we only require the issue

119
00:08:37,740 --> 00:08:38,640
that is basically.

120
00:08:39,560 --> 00:08:41,240
The car or the board angle.

121
00:08:42,550 --> 00:08:46,360
The boat angle, which is an image and its distance.

122
00:08:46,370 --> 00:08:47,920
But we only acquired the what angle.

123
00:08:48,700 --> 00:08:53,200
Then once we have the board angle an image, we now require the board angle in simulation.

124
00:08:53,590 --> 00:08:55,240
But first, let me see all this.

125
00:08:55,240 --> 00:08:55,930
What angle?

126
00:08:56,830 --> 00:08:58,350
In another instance variable.

127
00:08:58,390 --> 00:09:01,300
That is the board and in it to print it out later on.

128
00:09:01,870 --> 00:09:07,810
Now we need to extract the board angle in simulation because we have the board angle an image to compute

129
00:09:07,810 --> 00:09:10,420
the board and the relation between image and simulation.

130
00:09:10,900 --> 00:09:16,030
So let's create that particular functionality right about the angle and distance function.

131
00:09:17,880 --> 00:09:25,500
And this is similar to what Mr. Luke wanted to compute at Angle in simulation in his go to go lot by

132
00:09:25,500 --> 00:09:25,830
far.

133
00:09:26,310 --> 00:09:33,480
So we use the ILO from Catalonian, we compute the the same get both and we get the yard in degrees

134
00:09:33,480 --> 00:09:37,320
of converting the your computer from either from Catalonian to degrees.

135
00:09:37,470 --> 00:09:40,740
And then I erred in a few line of code here.

136
00:09:40,750 --> 00:09:48,600
What I did is I basically converted the -180 to 1 into degree range of the your degrees to 0 to 360

137
00:09:48,780 --> 00:09:55,140
to maintain the consistency in frame of reference because the angle computed in image was in 0 to 60

138
00:09:55,140 --> 00:09:55,530
degrees.

139
00:09:55,740 --> 00:10:02,640
So we want the same transitory degree range for our angle in simulation computed from the post or the

140
00:10:02,640 --> 00:10:03,570
get post function.

141
00:10:03,900 --> 00:10:10,350
So basically what we do is take the negative your degrees and simply add in the 360, which really gives

142
00:10:10,350 --> 00:10:16,590
us the total range of 0 to 360 as the final output for the angle in simulation.

143
00:10:16,890 --> 00:10:21,840
So once we have the board angle simulation updated, we can now move to the navigate ball function.

144
00:10:22,080 --> 00:10:27,180
After we have compute the board angle and image, you can now compute the board angle relation and that

145
00:10:27,180 --> 00:10:36,660
is done by simply writing what angle relation right here, the board angle simulation, negative or

146
00:10:36,660 --> 00:10:37,380
subtracting.

147
00:10:38,910 --> 00:10:40,170
The bolt angle in image.

148
00:10:40,590 --> 00:10:44,790
This gives us the boat angulation so now that the boat and the relation.

149
00:10:45,060 --> 00:10:51,840
One thing I missed out earlier is that we create an instance are able to track the angle relation between

150
00:10:51,840 --> 00:10:54,030
the image and the simulation has been computed or not.

151
00:10:54,390 --> 00:10:57,510
So we need to check that before moving forward further.

152
00:10:57,750 --> 00:11:05,430
So we right here, if not self-support or angle relation, computed or not.

153
00:11:05,790 --> 00:11:09,200
So if it is not computed, then we compute this angle.

154
00:11:10,240 --> 00:11:16,270
So once we have completed the board and coalition, then we can see that we have completed the board

155
00:11:16,300 --> 00:11:21,520
and good relationship or the anger or the anger relationship computed to true.

156
00:11:22,150 --> 00:11:28,570
This means once we have the anger relationship computed, we can now use the simulation angle to retrieve

157
00:11:28,570 --> 00:11:30,760
the angle in image for the board.

158
00:11:31,330 --> 00:11:35,020
So we do the same process by simply addressing the case.

159
00:11:35,440 --> 00:11:42,250
Once we have the anger relationship computed, we now use that relationship along with the simulation

160
00:11:42,250 --> 00:11:46,200
angle to compute the bot angle, and that is done very similarly.

161
00:11:46,200 --> 00:11:52,570
We simply say the bot angle simulation and subtract the bot angle relationship.

162
00:11:52,570 --> 00:11:58,180
We have just computed earlier to get the bot angle in image, so we don't need to compute the bot angle.

163
00:11:58,390 --> 00:12:05,170
Now every time we could just use the bot angle in simulation, subtract this from our bot and religion

164
00:12:05,170 --> 00:12:09,580
and we get the bot angle an image which required for consistency of frame of reference.

165
00:12:09,970 --> 00:12:16,270
So once we have this information, we can simply print it out, print out the column location and print

166
00:12:16,270 --> 00:12:19,630
out the initial what angle and this is has been completed.

167
00:12:20,170 --> 00:12:27,790
So once we have completed this, we now have the initial task of computing the bot angle or bot orientation

168
00:12:28,180 --> 00:12:31,090
in the image along with the bot location computed.

169
00:12:31,300 --> 00:12:37,390
So we now have the complete robot post in image and now we can proceed further to create the go to go

170
00:12:37,390 --> 00:12:37,810
function.

171
00:12:39,320 --> 00:12:42,560
To perform the analysis of the first day or the motion black last.

172
00:12:42,800 --> 00:12:43,700
We head on over.

173
00:12:43,880 --> 00:12:44,390
The mist.

174
00:12:44,390 --> 00:12:44,780
Over.

175
00:12:46,870 --> 00:12:51,400
Where we perform the necessary inputs to integrate the motion class to our project.

176
00:12:51,730 --> 00:12:56,290
The first import is basically importing the board motion planner class from the bought motion planning

177
00:12:56,290 --> 00:13:01,420
file and then also importing the dormitory from the navigating message message.

178
00:13:01,930 --> 00:13:07,240
Once we have these inputs, we head on over to the miss of the class where we are inside the installation

179
00:13:07,240 --> 00:13:07,690
function.

180
00:13:08,080 --> 00:13:11,710
We simply perform or create the object or the motion class.

181
00:13:11,980 --> 00:13:18,280
And then we also create the object or the bus subscriber that basically uses the dormitory to compute

182
00:13:18,280 --> 00:13:24,980
the pose of our car in simulation and also on the information of the pose to the function of the bot

183
00:13:25,000 --> 00:13:25,870
motion class.

184
00:13:26,500 --> 00:13:32,380
So once we have these two objects created, we can now head over to the main solving function where

185
00:13:32,740 --> 00:13:38,710
after we perform the fourth planning stage or the third state of our robot navigation, we create or

186
00:13:38,710 --> 00:13:43,300
perform the fourth and the final state of our robot navigation that the motion planner.

187
00:13:43,900 --> 00:13:49,120
So we call them what motion planner function of navigate bot which takes in four input arguments.

188
00:13:49,490 --> 00:13:55,450
The first input argument is basically a bot location or the location of our robot at this current moment.

189
00:13:55,780 --> 00:14:00,790
So this is basically free from the bot localized localized locus location car.

190
00:14:01,150 --> 00:14:06,310
So once we have this bot location passed to this navigate path function, we then head over to the second

191
00:14:06,580 --> 00:14:12,460
input argument of this function that is the bot to go the port to gold was computed by the first stage

192
00:14:12,490 --> 00:14:13,630
or the bot then a class.

193
00:14:13,990 --> 00:14:16,090
So you head on to work with the bot partner.

194
00:14:16,390 --> 00:14:17,770
Well we have the part to go.

195
00:14:18,370 --> 00:14:24,130
At this moment we have not created an instance variable or part to go, so we need to create this instance

196
00:14:24,130 --> 00:14:28,540
variable that basically still was the bot to go for our robot.

197
00:14:28,870 --> 00:14:30,940
So we head on over to the bot planning part.

198
00:14:31,900 --> 00:14:34,420
So here we are, the path planning.

199
00:14:34,930 --> 00:14:40,870
We go to the initial license function where we create the instance variable of part to go and initialized

200
00:14:40,870 --> 00:14:41,890
this to an empty list.

201
00:14:42,280 --> 00:14:47,380
Then we head on over to the find path and display function that's just called from the Salvador part.

202
00:14:48,010 --> 00:14:53,170
Go scroll down to where we have the bot to display and assign its value to the bot to go.

203
00:14:53,530 --> 00:14:59,590
So now our third or part to goal instance where able for the more authentic class now has the path to

204
00:14:59,590 --> 00:15:00,010
display.

205
00:15:00,550 --> 00:15:06,730
So we now head on over back to the solver, assign this value to the bot variable and then pass this

206
00:15:06,730 --> 00:15:08,350
as a second argument or navigate.

207
00:15:08,350 --> 00:15:15,160
But then for the third input argument, we need to provide the velocity object as a third input argument.

208
00:15:15,400 --> 00:15:21,610
And this is basically the velocity message that was created earlier that basically clears the object

209
00:15:21,610 --> 00:15:22,420
of the quiz class.

210
00:15:22,990 --> 00:15:29,080
And then we have the Velocity publisher to basically publish the velocity once it has been updated.

211
00:15:29,380 --> 00:15:33,310
So this is basically initialized right at the top of the instruction function.

212
00:15:33,820 --> 00:15:39,190
And then once we have completed this input arguments, our navigate bot function has been completed

213
00:15:39,340 --> 00:15:44,140
and the integration of the full stage of the motion planner class has been completed.

214
00:15:44,620 --> 00:15:47,980
Now, before testing this out, we need to perform a few more steps.

215
00:15:48,400 --> 00:15:55,330
The first step is that we need to head over and simply close this with keys everywhere they present.

216
00:15:55,540 --> 00:15:59,290
Because for the motion planner to work, we need the cart to move freely.

217
00:15:59,830 --> 00:16:04,180
And this is simply stop the operation at wherever they are placed.

218
00:16:04,630 --> 00:16:06,370
So we simply said turn them off.

219
00:16:06,920 --> 00:16:07,980
By recommending them out.

220
00:16:08,650 --> 00:16:11,740
We head over to Polyclinic where we also have the key.

221
00:16:12,430 --> 00:16:18,910
So we turn this off to we head on over to the bot mapping, we turn this off to we head on over to the

222
00:16:18,910 --> 00:16:19,660
localization.

223
00:16:19,660 --> 00:16:20,740
We don't have the weight key.

224
00:16:21,220 --> 00:16:26,680
So we're back to the MI solver and hopefully the stopping has gone.

225
00:16:27,040 --> 00:16:33,550
So another thing that we need to do, we need to head over to the bot planning or mapping.

226
00:16:34,000 --> 00:16:40,180
What is happening right here is because the graph has been created so it is not needed to be created

227
00:16:40,180 --> 00:16:40,480
again.

228
00:16:40,780 --> 00:16:44,410
So we need to set this self-talk graph from false to true.

229
00:16:44,740 --> 00:16:51,580
So we head on over to down here, set the self taught graphic fight state variable for mapping state

230
00:16:52,000 --> 00:16:52,510
to truth.

231
00:16:53,140 --> 00:16:59,350
So what this will do is basically say that only do the mapping once and not anymore.

232
00:16:59,800 --> 00:17:07,630
So once we have done this, we head on over to the Ms. solver and then proceed on the terminal and then

233
00:17:07,630 --> 00:17:08,440
build the project.

234
00:17:08,980 --> 00:17:10,060
So we build the project.

235
00:17:11,900 --> 00:17:14,650
We run the simulation once the simulation starts.

236
00:17:15,080 --> 00:17:18,770
We head on over to the second terminal and then run the solver.

237
00:17:20,270 --> 00:17:26,300
So once we get the output of the license plate, you press spacebar and then we get the output for our

238
00:17:26,300 --> 00:17:27,230
localization states.

239
00:17:27,410 --> 00:17:30,290
Once more after one complete iteration.

240
00:17:31,130 --> 00:17:37,130
So if you can see right here, we have landed on our error and the error see that we have a type error

241
00:17:37,130 --> 00:17:39,350
that the object is not subscribed to.

242
00:17:40,100 --> 00:17:43,340
So what is that object that is being called to be clear?

243
00:17:44,210 --> 00:17:48,470
So this error is coming at the angry, distant function of the board motion lost.

244
00:17:48,800 --> 00:17:53,510
And this is coming at line 76 where we were computing the error in the x axis.

245
00:17:54,080 --> 00:18:01,130
So basically this particular function was taking in the location of our car in two different intervals

246
00:18:01,130 --> 00:18:01,550
of time.

247
00:18:02,090 --> 00:18:07,910
And the location of the car is basically in the format of tuple and that is subscript over, but it

248
00:18:07,910 --> 00:18:09,440
is getting that into object.

249
00:18:10,040 --> 00:18:13,790
So the error is coming from from somewhere in the localizing states.

250
00:18:14,210 --> 00:18:19,790
So we head on over to the localized state and see whether we are computing the localization or the car

251
00:18:19,790 --> 00:18:21,560
location correctly or not.

252
00:18:22,220 --> 00:18:28,600
So if we head over to the localized state at the local spot function, what we observe is that when

253
00:18:28,700 --> 00:18:35,120
once we have computed the background where we are computing it for for the first citation and then not

254
00:18:35,120 --> 00:18:37,130
proceeding on in the first iteration.

255
00:18:37,790 --> 00:18:42,080
So in the first iteration we are not retrieving the car location.

256
00:18:42,350 --> 00:18:46,400
So what we have initialized our car location to the instance variable.

257
00:18:47,120 --> 00:18:53,030
It is we have initialized this to an empty in in function or an integer.

258
00:18:53,630 --> 00:18:59,570
So this is what is causing the error in the first iteration of our solver type.

259
00:19:00,350 --> 00:19:06,260
So what we need to do need to simply say that once you have computed the background, you don't need

260
00:19:06,260 --> 00:19:09,290
to wait for the next iteration to compute the car location.

261
00:19:10,240 --> 00:19:13,480
You can simply compute the card location in the same migration.

262
00:19:13,960 --> 00:19:14,380
So we.

263
00:19:15,320 --> 00:19:16,270
Delete this else.

264
00:19:18,020 --> 00:19:19,820
And simply take this back.

265
00:19:20,030 --> 00:19:25,130
And then once we have the background extracted, we can now proceed to the second step, the third step,

266
00:19:25,250 --> 00:19:27,320
and eventually extracting the car location.

267
00:19:27,890 --> 00:19:32,390
So the location of the car is extracted on every iteration, even on the first.

268
00:19:32,930 --> 00:19:33,650
So hopefully.

269
00:19:35,470 --> 00:19:36,490
This fixes the error.

270
00:19:36,700 --> 00:19:38,170
So we head on over to the terminal.

271
00:19:39,360 --> 00:19:40,320
Close the simulation.

272
00:19:41,860 --> 00:19:42,640
Will the project.

273
00:19:44,280 --> 00:19:46,020
We rerun our simulation.

274
00:19:47,290 --> 00:19:49,630
And then run the missile over on the next terminal.

275
00:19:50,960 --> 00:19:55,820
And once the missile runs, we get the output of our nuke license state.

276
00:19:56,030 --> 00:19:58,430
You press enter, then we get the output.

277
00:19:59,380 --> 00:19:59,940
For our car.

278
00:19:59,950 --> 00:20:00,470
Localized.

279
00:20:00,790 --> 00:20:01,900
So at this moment.

280
00:20:02,990 --> 00:20:04,610
What is happening is that we are seeing.

281
00:20:05,980 --> 00:20:09,910
That we are seeing some output and this output seems to be wrong.

282
00:20:10,240 --> 00:20:13,240
The problem is that the car hasn't moved from its initial location.

283
00:20:13,540 --> 00:20:18,640
But to compute the car, location or the car, cause we want it to move from its initial location to

284
00:20:18,640 --> 00:20:19,910
some final location.

285
00:20:19,930 --> 00:20:23,200
After moving forward for a few frames, but it hasn't moved.

286
00:20:23,590 --> 00:20:24,640
Where is the problem?

287
00:20:25,180 --> 00:20:30,520
So somewhere in our code we have reset our velocity of our car back to zero.

288
00:20:30,940 --> 00:20:38,740
So we close this down, close the simulation head on over to the Ms. Solver and voila, right at the

289
00:20:38,740 --> 00:20:45,310
end of our Ms. solving function, we are simply resetting our linear component of our velocity message,

290
00:20:45,580 --> 00:20:49,840
drop back down to zero and then publishing is using the velocity publisher.

291
00:20:50,230 --> 00:20:56,620
So even though in the ocean planning it was setting it one for first 20 iteration, we are resetting

292
00:20:56,620 --> 00:20:58,840
it to zero right over here.

293
00:20:59,080 --> 00:21:04,420
So this is causing our car to not move and getting incorrect car orientation computed.

294
00:21:04,720 --> 00:21:09,070
So we need to delete this line of code because we do not need it anymore.

295
00:21:10,120 --> 00:21:14,650
So hopefully once we run this again, we get the correct output.

296
00:21:15,160 --> 00:21:16,510
So we run the simulation again.

297
00:21:18,040 --> 00:21:21,160
Once we have the simulation run up, we the solar.

298
00:21:22,640 --> 00:21:25,700
And once we have the output of the locations, do you press spacebar?

299
00:21:26,720 --> 00:21:27,590
And this time.

300
00:21:28,730 --> 00:21:32,120
You can see that God was moving from this initial location to the final location.

301
00:21:32,540 --> 00:21:37,970
And this time, if you look at the output, we get the output of the car angle initial.

302
00:21:38,060 --> 00:21:43,730
So the initial angle that was computed from the initial location to the final location was to 70 degrees.

303
00:21:44,240 --> 00:21:50,900
And the car angle in simulation was basically at this moment is to 70 degrees two.

304
00:21:51,110 --> 00:21:55,760
So it hasn't changed because we're just moving in the forward direction with no change in angle.

305
00:21:56,090 --> 00:22:00,680
So the car angle in simulation is also to 70 degrees as as of this moment.

306
00:22:01,070 --> 00:22:09,350
And the car computer or the car angle for the image computed from relation is basically to 70.6 degrees.

307
00:22:09,860 --> 00:22:15,290
And the relationship between the image and simulation for the car angle is basically just negative point

308
00:22:15,290 --> 00:22:16,190
one, two degrees.

309
00:22:16,820 --> 00:22:23,060
So using the relation, we're now able to compute the car angle and image from just the simulation using

310
00:22:23,060 --> 00:22:23,630
the relation.

311
00:22:24,320 --> 00:22:29,990
So car location at this moment is basically 300 pixels to 97 pixels in x and y axis.

312
00:22:30,350 --> 00:22:32,510
And if we head on over to the simulation.

313
00:22:34,000 --> 00:22:34,420
And.

314
00:22:35,450 --> 00:22:37,520
Pick our terminal right on the top.

315
00:22:39,440 --> 00:22:40,970
Set it to always on top.

316
00:22:41,540 --> 00:22:47,540
We can now modify of a car, location or orientation and see whether it changes or not.

317
00:22:48,050 --> 00:22:49,790
So if I changes.

318
00:22:51,670 --> 00:22:53,440
Left facing to the wall.

319
00:22:54,010 --> 00:22:56,320
He see that the angle computed for the car.

320
00:22:58,230 --> 00:22:59,940
It's basically 16 degrees.

321
00:23:00,270 --> 00:23:02,640
So at this moment, the car is 16 degrees.

322
00:23:02,940 --> 00:23:05,190
And if I increase its angle.

323
00:23:06,740 --> 00:23:08,330
To face to means entry.

324
00:23:08,660 --> 00:23:15,290
It increases to 90 degrees and then I increase this other dimmer phase opposite to the wall.

325
00:23:15,710 --> 00:23:17,900
It now goes to one or two degrees.

326
00:23:18,440 --> 00:23:22,550
So basically it is increasing from the left facing the wall.

327
00:23:23,120 --> 00:23:23,840
It is zero.

328
00:23:25,550 --> 00:23:32,960
Then it increases to one or two degrees and then once it gets goes opposite and once it goes opposite

329
00:23:32,960 --> 00:23:36,800
to the wall through the entry, it basically increases to 270 degrees.

330
00:23:37,100 --> 00:23:41,240
And then going back to the wall, it increases to 360 degrees.

331
00:23:41,570 --> 00:23:44,180
So 0 to 3 is 60 in this direction.

332
00:23:45,080 --> 00:23:50,480
Now with this, we can confidently say that we have the complete bot angle computed from the bot angle

333
00:23:50,480 --> 00:23:52,460
and simulation and its relation.

334
00:23:52,910 --> 00:23:55,890
Combining this bot orientation with the bot location.

335
00:23:56,090 --> 00:23:57,740
We have the complete robot post.

336
00:23:58,190 --> 00:24:04,400
This means we can proceed onwards to defining the go to go function to make the robot reestimates exit

337
00:24:04,910 --> 00:24:05,530
building.

338
00:24:06,110 --> 00:24:06,440
Happy.

339
00:24:06,440 --> 00:24:06,710
Good.

340
00:24:07,280 --> 00:24:07,640
But.
