-
Title:
06-08 Your Robot Car
-
Description:
-
Now let's put them all together into a single piece of software.
-
Upfront it took me about a whole day to do this.
-
I'm not going to ask you to do it all yourself,
-
because it's going to cost you probably at least an hour if it takes me a day.
-
But I still want to be able to take all the lessons that we did together into a single system.
-
I'm going to help you a little bit--bits and pieces--
-
but up front here is the environment that I wrote for you,
-
which is very much derived from the environment we studied in the past.
-
We have a class robot that has certain kinds of noise characteristics you can find over here.
-
As I scroll down, you can see the familiar init function, the position-setting function,
-
the set_noise function, and then we have two checking functions--
-
whether we have a collision with the world called "grid," which I will show you in a minute.
-
and we have a check_goal function to see if we reached a goal
-
according to a certain distance threshold.
-
The move function should be very familiar at this point.
-
It applies noise to the motion command.
-
It the same code that you originally wrote.
-
Then we have a very simple sense function, which measures the robot's (x, y) location,
-
similar to a GPS on a car but with substantial measurement noise.
-
Corresponding to this sense function we have a measurement probability function
-
that you might want to use in your filter, and it evaluates the probability
-
of a measurement relative to the ground truth coordinates of the robot using Gaussians.
-
Armed with all this here is the problem.
-
I'm going to give you a grid. Here is an example grid. Let me draw this for you.
-
This specific one happens to be of dimensions 6 and 5,
-
and there are a number of blocked off cells like this.
-
If we look carefully into the code, you'll find information about the initial starting location
-
on the left upper corner and the goal location, which is the bottom right corner.
-
In putting everything together, you're going to build a robotic car using our bicycle model
-
that'll drive through the free space through the continuous free space
-
on something close to the shortest path all the way into the goal.
-
Here is my solution that I implemented
-
and that you will get to see for the most part towards the end of this class.
-
I am starting up over here. These are my obstacles.
-
They implement as circles through the center of these grid cells.
-
It's not exactly correct but good enough for my implementation.
-
Here are multiple runs using the same code, and you can see they're far from optimal.
-
They are non-optimal because there is control noise,
-
and there is also measurement noise.
-
But they all make it safely through free space into the corner where the goal objective is.
-
If we look at them in detail, like this solution over here.
-
You'll find that the spacing of the circles is somewhat variable.
-
You'll find that there's little corners over here that are either the result of control noise
-
or of measurement noise or of my somewhat deficient implementation.
-
You'll also find the control set points that are the smooth points of my A-star planner
-
as shown here in green.
-
In the version that I implemented for you, the controller does something very, very different.
-
It actually chooses as the control objective to head straight to the goal,
-
using the atan2 function, executes the action at a speed of 0.1,
-
and then reports a collision whenever the robot is moving.
-
Just looking down to the output where we see the robot's coordinates
-
along with the orientation there are very frequent collisions
-
that the robot undergoes in its attempt to reach the goal,
-
which it eventually does, but you can see 2 big regions of collisions
-
until the goal is finally reached.