GithubHelp home page GithubHelp logo

bgl_minimal_example's Introduction

BGL_MINIMAL_EXAMPLE

This repository provides a minimal working example of running A* graph search with Boost Graph Library. There are more general examples of this use case [1,2], but this example focuses on the use case for roadmap-based path planning.

Here, each vertex has an attribute which is the configuration space point that it represents, and each edge has attributes for the edge weight (typically some distance function between vertices) and the edge status (whether collision-free or not).

The following behaviour is exemplified here :

  • Loading a Boost .graphml file that defines the configuration that each vertex represents, and the edges connecting vertices. This is sometimes called an explicit roadmap (graph).
  • Defining the struct types that represent the attributes of the vertices and edges of the graph.
  • Creating a Boost Graph (specifically an undirected graph represented as an adjacency list), as well as the property maps that map the vertices and edges to their attributes.
  • Defining a heuristic function for A* search that depends on the underlying configurations of the vertices (as they typically should).
  • Running boost::astar_search in its most general form with all the relevant arguments, to obtain the shortest path between two randomly chosen vertices.

Dependencies

This has been tested on Ubuntu 14.04 and 16.04 as well as MacOS Sierra (with some particular tweaks mentioned below). Following are the dependencies:

A Note on MacOS - What worked for me was to replace ${Boost_INCLUDE_DIRS} with ${Boost_INCLUDE_DIR} and ${EIGEN3_INCLUDE_DIRS} with ${EIGEN3_INCLUDE_DIR} in CMakeLists.txt.

Usage

To run, clone the repo and do the following inside the top-level directory of the repo:

mkdir build && cd build
cmake ..
make
./example --r ../data/halton_2d_withedges.graphml --d 2

Additional Comments

The data/ folder has an example .graphml file where the vertices are sampled on a 2D unit grid. The roadmap has 30 vertices and the configurations are generated from a 2D Halton sequence, and edges connect vertices with mutual Euclidean distance less than some threshold. The graphs themselves were generated with NetworkX where the configurations are specified as vertex attributes.

It is not best practice to place everything in one .cpp file, especially when there are reusable modules, but I have done so for the purposes of this minimal example to make it easier to follow. Finally, I have put in some NOTE: tags in the commands to highlight important points about usage.

bgl_minimal_example's People

Contributors

shushman avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.