To incorporate obstacle navigation to the Board Motion Planning class, you first need to add a few
sets of instance variables inside of an entered function, so we head over to the ADD function.
Scroll down and then add the full set of instance variables that are basically containers, the stores,
the previous angle to tune, distance to go, and the port iteration.
By storing this previous information about these particular values, we now have the information of
whether these particular values has changed from the previous iteration to the current migration.
And if they haven't changed, then we can be sure that we need to perform obstacle navigation because
our robot is stuck somewhere on the map.
Then we head on over to the next instance we're able that are basically outrageous and these are great
as basically keeps track of how many iterations has elapsed since one of these values has not changed.
That includes the angle, the distance, the goal, and then we have the counter that tells how much
time has elapsed since we have backpedalling.
And then we are the last set of instance variable that are basically state variables.
The first is the trigger backpedalling.
That is for the case when we are stuck on a world and we need to backpedal to try to reach the next
meaning goal.
And then the next step is basically the trigger next point.
If we cannot reach a particular angle, then we need to activate the stick on next point to try to reach
the next winning goal because that is reachable and both of these initialize to false.
Then we head on over to the go to go function where we need to add in the functionality to check the
go to assert us.
To do that, we need to add a new function before the go to go function.
And that would be.
The check go to Google status.
This takes it to input arguments.
The first is the angle to tone, and the second is a distance to what?
Here.
The first thing that we do is basically compute the change in the angle to turn.
And this can be done by simply taking the current angle to turn and subtracting it with the previous
angle to turn datastore inside the instance variable.
This gives us the change in the angle to turn, and if the angle has not changed, it is large and it
does not change for a long time and we haven't performed the back panel.
Then what we need to do, we are to simply increment the angle, not change our data.
So once the angle of change reaches 200, we aim to trigger the backpedaling because the angle has not
changed for a significant amount of time, indicating that the robot is stuck on a ball and it needs
to backpedal to try to reach the next minute goal.
Otherwise, we simply reset the angle, not change, and set the previous angle to turn to the current
angle to turn.
Then we address the case for where we have the change in distance, and that can be computed by simply
subtracting the distance to go and the previous distance to go.
This gives us the change in the distance and the same way as we were doing for the angle.
We check if the distance is large enough and not changing and the figure backpedaling has not been set.
Then we increment the distance, not change to what?
And if the this is not change is greater than 200, that arbitrator has reached 200.
Basically, a long time has elapsed since the distance between the court and the winning goal has not
changed.
Then we triggered the backpedaling because the car is stuck on a ball again and it needs to backpedal
to try to reach the next main goal.
Otherwise, we set the distance, start change and set the previous distance to go to the current,
the current distance to go.
Then we address that last case that can occur, and that is basically check if the goal or the winning
goal has not changed for the last duration, and that can be done by simply subtracting the previous
fourth alteration with the current iteration.
And this gives us the change in goal.
And if the changing goal of the goal has not changed and the distance to go is basically less than 30,
indicating that it is very relatively close to the car, then we implement the goal, not change outright.
And if the goal not change is less is greater than 500.
Basically a time has elapsed.
Then we trigger the next point because we cannot reach the winning goal.
And if the goal has not changed for a very long time, then we also trigger the next point because we
cannot reach that particular goal.
Otherwise we reset what these variables and then set the previous path over to the current path.
And this way we have incorporated the check go to world status.
So all we need to do is head on over to the go to goal function.
We're computing the speed and angle printed out.
We now check.
Whether if served or Google not reflect.
So if you haven't reached the final winning goal or basically have not reached the exit, then we can
check by calling the self check.
Go to go.
This takes in doing what argument the first is angled to doing, and the second is a distance to go.
So we check the go to goal status and if we have found a case where we need to perform obstacle navigation,
either backpedalling or to the next point, then we need to address that particular case.
So we need to define what should happen or how would backpedaling occur.
So we scroll down where you are publishing the velocity before this, publishing the velocity that we
updated, we need to perform the backpedaling definition.
That is basically if the trigger backpedaling has been activated, what should we do?
What we need to do is simply check if the seller backpedaling article is equal to zero, then we say
that we need to go to the next point.
This means that we need to load the next winning goal.
And then we simply said the linear component of our willingness to object to negative, to indicate
to our card that it needs to move in reverse.
And then we set the angle to angle and then we increment the back pedaling our greater by one.
So if this backpedaling goes on for a significant amount of time until just backpedaling after two 100,
then we reset the trigger backpedaling with 72 falls, and we reset the backpedaling outright to zero.
And the backpedaling has done, and the car can now reach the next winning goal.
So once we have defined the case for the backpedaling, we need to define the case for what should happen
when the trigger next point has been activated.
So when the trigger next is activated, we don't need to reach the current winning goal.
We can simply try to reach the next winning goal.
So this condition where we are simply checking if the company goal is within the reach and we have reached
that particular meaning goal can simply be added with.
If self-taught.
Trigger point has been activated or not.
So the trigger next point is activated.
Then we don't need to use that current meaning we can simply activate the next memory go so we can simply
incorporate the next condition or simply incorporate the condition to trigger the next point before
encountering that particular condition or calling that political function.
We need to define the function that triggers the next point so we can scroll up and for the go to go
function and adding that functionality.
That is to get suitable.
Next point.
So once we have defined this functionality of getting the next suitable next point for the kids, we
are stuck behind the wheel.
You can now call this functionality inside the case where we were approaching the next meaning goal.
So we defined that functionality of where if we have set the trigger next point activated and if we
were backpedaling indicating that we are stuck on a goal and we cannot reach that particular meaning,
then we need to get the suitable next point because the next closest next point might not be accessible
anymore.
So we need to get the suitable next point by calling in the function, by providing the current board
location and the current path that we have computed in the planning stage.
So this means that we have completely incorporated the obstacle navigation to our board motion planner
class and hopefully our missile board will be able to solve the more complex means to.
All right, guys, it's the moment of truth.
Will our Minnesota board be able to solve the more complex maze, too?
After adding an obstacle navigation feature to aid in the analysis in the view of the missile robot
is seen in front of it.
This will give us the on site information of what kind of obstacles our Mr. Robot is navigating around.
What we can be added by just getting a new subscriber to subscribe to the bot camera slash image roll
and passes on this information to the process data more function than inside the process data about
function.
We take that data and convert it to save it to image format and save it inside the body variable.
Then we head on over to the misfolding function where we simply overlay our bot view on the left hand
side of the frame display to have both the top view and the bar view on the same screen.
So we head on over to the terminal, build the project.
And then launch the maze to simulation and once the mate to simulation starts up.
It will run the Mets solver.
So the first output that we get is basically the output of the localization state, that is the MES
occupancy grid shown on top of the screen.
Then you press spacebar and we get the final output.
That is the maze being solved live by our main robot.
And on the left hand side of the screen we have the board view being displayed on on in front of us
and we can also display on the right hand side of the screen the maze reference image that basically
displays the maze in the form reference there that is basically oriented having the maze entry right
on top.
Then the shortest path is this being displayed on this maze reference image in the form of a color line.
And we also have the board location being displayed on the red circle, on the maze reference image.
And the green circle represents the many goals that have already been completed and the audience represents
the winning goal that the board is currently trying to navigate.
So you can see the board is trying to solve this particular maze and it is orienting itself to the next
mini goal that is very far from it and this is why it is moving very fast.
So as it approaches the first of its major obstacle, that is basically a very narrow corridor and this
is a position where it got stuck earlier and let's see if it is able to navigate this time around after
adding an obstacle navigation feature.
So it is approaching the mini goal and this mini Google approach more and more closer to the wall.
So finally, you will see that one of these mini goals is right on top of the wall, and this is why
our may solve board might get stuck at this position.
So you can see the board is turning towards the wall in the left hand side of the screen where you can
see the board view is just seeing the wall at this moment.
And if you look at our simulation, you can see the car is stuck in this particular location.
And it is stuck right over here and it is trying to approach that.
You go.
So let's see if one of our check what Google status is being triggered and the car navigates around
this condition, but it is stuck behind the wheel.
So you can see that a distance of this particular goal is not changing and it is going from 0 to 200.
And if it reaches a 200 counter, then it will simply backpedal and then try to reach the next minute
goal.
Let's see if it does that.
So if it reaches the 200 and you can see the backpedaling starts and the car back pedals until the backpedaling
counter reaches 100.
So it backpedaled, moves in reverse with the same angle that was moving, and then tries to reach the
next minute goal.
So at this moment it is approaching backpedaling for 200 counter and it is backpedaling and then it
will try to reach the next minute goal.
So backpedaling finishes and then it will start approaching its next minute goal.
Well, you can see it is approaching the next minute goal right now.
So if I display them, live me.
Is that what was happening?
So you can see that it is approaching the next minute goal, which is in.
In reverse.
You can see it is making a 180 degree turn to try to approach that eagle.
And you can also observe it on the left hand side.
But you try to.
Hurry, hurry, hurry, hurry, hurry.
So at this moment, it is approaching another very difficult terrain, what it means to navigate around
irregular objects, shark dunes, and not get stuck in this location.
And even if it gets stuck, it needs to get itself free and try to reach the end of this particular
maze.
So it is stuck at this particular location.
And if you what condition is being triggered at this moment?
You can see that the car is stuck at this location and angle is being changing because the car is actually
moving, but its distance is not changing for its incrementing and the goal is also not changing.
So this counter is also going from 0 to 40 at this moment.
So the mini Goulds are very close to the car at this moment and this is why they are being triggered.
And then we try to approach the next to go to.
So at this moment, you can see the car is stuck on this very tight turn and it's trying to approach
to next to go.
So it reorients itself and then tries to approach the next minute go.
But turning towards that particular winning goal.
So it is making a 360 degree turn to orient yourself in the direction of that winning goal.
So you can see on the left hand side the guys approaching the next many goals.
In our screen.
Oops.
She?
I.
Hurry, hurry, hurry, hurry, hurry, hurry, hurry, hurry, hurry, hurry, hurry, hurry, hurry,
hurry, hurry.
She?
So this is the last major obstacle with our God.
We find much difficulty in trying to navigate around.
The problem is that in this particular ball, the winning goal are very close to the ball and it is
a particular card that is on the outside of its structure.
Get stuck on this particular ball.
So let's see which condition gets triggered first.
So whether the goal has not changed for 200 iterations or the distance is not changed for that particular
goal, but 200 iterations of the angle has not changed.
So you can see the goal was not changed for 200 iterations and then it tries to reach the next winning
goal.
So the next trigger next point is being activated and it tries to meet the next minute goal.
And on the right hand side of the screen, you can simply view of the car where the car is at its point
in the shortest part as well.
So it is approaching the shortest path to go and it is navigating around the shortest path, quite remarkably.
I might say.
So it is reorienting itself and then approaching the in goal.
And then you can see its position on the right hand side of the screen and you can see on the left hand
side of the screen, the board view is viewing the miss exit from this far away and it can see the goal
in front of it.
Right.
Hi.
Hurry.
Hurry, hurry, hurry, hurry.
Hurry.
Hurry, hurry, hurry, hurry, hurry.
She?
I.
Hurry, hurry, hurry, hurry.
So you can see after the first few hurdles, everything else was a walk in the park for me and store
bought.
So it will just reach all those many goals and then approach the final few, many goals.
And you can see at this moment the total many goals that the car had reached for 299 and it has already
completed a total of eight many goals.
So it is approaching the final few sets of many goals to reach the men's exit.
And let's see if it does their job.
Hurry, hurry, hurry.
So it is approaching the men's exit and can see them is active right in front of it is orienting itself
towards the exit right now.
And you can see it looks a far into the void.
So it is approaching the final minute goal and you can see.
Hurry, hurry, hurry, hurry.
And voila, it is reached the final minute goal.
So indeed the obstacle navigation feature that we incorporated to our main solving what has made it
solve the more complex me as to and made our may solver bought a much more reliable option for solving
mazes.
So that's it for today.
Then, then.
But.