Artificial Intelligence for Robotics

Since I finished the first term of the Self-Driving Car Nanodegree early I had few weeks before term 2 started. I decided to take the class Artificial Intelligence for Robotics as I was very interested in the material it covered. In this class I learned about robot localization, Kalman filters, particle filters, A* search, and SLAM.

Below you can see a Kalman filter I programmed in Python that is localizing a robot and guessing where it will be in the next time step based off of its current movement. Essentially the filter takes in the robots current position in (x, y) and needs to determine based on that the robots heading, turning rate, speed, and acceleration.

 
LegendGreen - Robots exact position.Red - Robots measured position (exact position + measurement noise), this is what the Kalman filter receives.Blue - Robots predicted position based on Kalman filter. This prediction is done before the robot moves …

Legend
Green - Robots exact position.

Red - Robots measured position (exact position + measurement noise), this is what the Kalman filter receives.

Blue - Robots predicted position based on Kalman filter. This prediction is done before the robot moves and is guessing where the robots exact position will be in the next time step.

 

While I wrote code to solve problems like this one in the other subjects I learned, none of them had outputs that were as satisfying to see the results of. For example, the program I wrote to implement an A* search algorithm had the problem and answer shown below. The function will find a path between the start and goal shown in the matrix grid based on the heuristic path shown in matrix heuristic. A* is useful because as you can see in the answer that the area in the top right of the space doesn't need to be explored when trying to find a path to the goal. Note for this example there is no robot or anything moving along the the path, the search algorithm is rather trying to plan a route from start to goal before the robot starts moving.

While the math and code behind the function is interesting, the inputs and outputs I worked with in this class are not very pleasing to look at which is why I won't showcase more of what I learned here. I believe term 2 of the SDC Nanodegree will have some overlap with these topics however so check out that project page if you want to see more!

Answer:

searchpath = [
[0, X, -1, -1, -1, -1], 
[1, X, -1, -1, -1, -1],
[2, X, -1, -1, -1, -1],
[3, X,  8,  9, 10, 11],
[4, 5,  6,  7,  X, 12]]

Problem:

grid = [
[S, 1, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 1, G]]

heuristic = [
[9, 8, 7, 6, 5, 4],
[8, 7, 6, 5, 4, 3],
[7, 6, 5, 4, 3, 2],
[6, 5, 4, 3, 2, 1],
[5, 4, 3, 2, 1, 0]]