Udacity - Robotics NanoDegree Program

RoboND-OccupancyGridMappingAlgorithm

You will visualize the mapped environment through the generated image

Instruction:

Code the visualization function which will plot the state of each grid cell using the matplotlib python library

void visualization()
{
    //Initialize a plot named Map of size 300x150
    
    //Loop over the log odds values of the cells and plot each cell state. 
    //Unkown state: green color, occupied state: black color, and free state: red color 
    
    //Save the image and close the plot 
}

Here are some helpful commands you can use to generate plots with the matplotlib library:

  • Set Title: plt::title("Your Title");
  • Set Limits: plt::xlim(x-axis lower limit, x-axis upper limit );
  • Plot Data:plt::plot({ x-value }, { y-value }, "Color and Shape");
  • Save Plot: plt::save("File name and directory");
  • Close Plot: plt::clf();

Check out this link for more information on the matplotlib C++ library. For information regarding the plot color and shape refer to the LineSpec and LineColor section of the MATLAB documentation.

Compiling:

$ cd RoboND-OccupancyGridMappingAlgorithm/
$ rm Images/*
$ g++ main.cpp -o app -std=c++11 -I/usr/include/python2.7 -lpython2.7

Running:

$ ./app

Now, wait for the program to generate the map!

Generated Map:

alt text