persinammon / route-planner

Plan routes using A* and open-source IO2D mapping data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Route Planner

This is a C++ implementation of a route planner for a vehicle (or pedestrian, etc.). I changed main.cpp and implemented modularized code for A* search using Euclidean distance from point to end point as the h(euristic) value. I used the full range of references, pointers, and syntactical sugar -> to implement methods, which was a welcome change from previous projects in Java and Python.

The program takes in an XML file of data (named as an OSM file) represented as nodes, ways, and relations. Nodes are points with x and y coordinates and metadata, ways are collections of points representing a path, and relations are groups of ways (e.g. multiple paths representing a freeway course).

Specifically, I:

  • Used the extraction operator >> to save user input in main.cpp. Used implicit conversion from int to float during variable reassignment of start and end coordinates. Using floats means the user is forced to write the number as a float e.g. 10f or 10.0.
  • Filled out methods in route_planner.cpp, with helpful comments on potential errors and additional information. All methods filled out are marked by a TODO. :~) As said earlier, worked with pointers and references.

Dependencies for Running Locally

Compiling and Running

Compiling

To compile the project, first, create a build directory and change to that directory:

mkdir build && cd build

From within the build directory, then run cmake and make as follows:

cmake ..
make

Running

The executable will be placed in the build directory. From within build, the project can be run with:

./OSM_A_star_search

Or to specify a map file:

./OSM_A_star_search -f ../<your_osm_file.osm>

Testing

The testing executable is also placed in the build directory. From within build, unit tests can be run as follows:

./test

About

Plan routes using A* and open-source IO2D mapping data

License:Other


Languages

Language:C++ 80.4%Language:CMake 19.6%