Coder Social home page Coder Social logo

robond-a-visualization's Introduction

Udacity - Robotics NanoDegree Program

RoboND-A-Visualization

You will visualize the shortest path for the robot to travel through the generated image

Instruction

The visualization function will plot the state of each grid cell using the matplotlib python library. Edit this function and plot the start position, goal position and path.

void visualization(Map map, Planner planner)
{
    //Graph Format
    plt::title("Path");
    plt::xlim(0, map.mapHeight);
    plt::ylim(0, map.mapWidth);

    // Draw every grid of the map:
    for (double x = 0; x < map.mapHeight; x++) {
        cout << "Remaining Rows= " << map.mapHeight - x << endl;
        for (double y = 0; y < map.mapWidth; y++) {
            if (map.map[x][y] == 0) { //Green unkown state
                plt::plot({ x }, { y }, "g.");
            }
            else if (map.map[x][y] > 0) { //Black occupied state
                plt::plot({ x }, { y }, "k.");
            }
            else { //Red free state
                plt::plot({ x }, { y }, "r.");
            }
        }
    }

    // TODO: Plot start and end states in blue colors using o and * respectively
    
    // TODO: Plot the robot path in blue color using a .
    
    //Save the image and close the plot
    plt::save("./Images/Path.png");
    plt::clf();
}

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 /home/workspace/
$ git clone https://github.com/udacity/RoboND-A-Visualization
$ cd /RoboND-A-Visualization/
$ rm -rf Images/* #Delete the folder content and not the folder itself!
$ 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 path!

Generated Path

alt text

robond-a-visualization's People

Contributors

karimchamaa avatar sudkul avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.