Skip to content

ayushkumar8340/AStar-CPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A* Path Planning in C++

This repository implements the A* path planning algorithm in C++. The A* algorithm is widely used in robotics and game development for efficiently finding the shortest path from a start node to a goal node in a grid-based map while avoiding obstacles.

A* Pathfinding Demo

🚀 Features

  • Simple and efficient A* algorithm implementation
  • Works on grid maps with user-defined obstacles
  • Easy to configure start and goal positions
  • Visual output (grid printed in terminal)
  • Lightweight and dependency-free

DEMO

A* A* A*

The above images show planning without post processing

A* A* A*

The above images show planning with post processing

📁 Directory Structure

├── astar.cpp # Core implementation of A* algorithm
├── astar.hpp # Header file for A* class
├── custom_map.cpp # Grid map creation and utility functions
├── custom_map.h
├── tests/test_planner.cpp # Main file to run the algorithm
├── Makefile # Makefile for building the project
└── README.md

🧠 A* Algorithm Overview

A* finds the lowest-cost path from a start to a goal node by combining:

  • g(n): Cost from start node to current node n
  • h(n): Heuristic cost estimate from n to goal (using Manhattan distance here)
  • f(n) = g(n) + h(n): Total estimated cost

The algorithm uses a priority queue (min-heap) to explore nodes in order of lowest f(n).

✅ Requirements

  • C++11 or higher
  • A C++ compiler (e.g. g++)
  • Docker
  • OpenCV 4.1.1

⚙️ Build Instructions

git clone https://github.com/ayushkumar8340/AStar-CPP.git
cd AStar-CPP
./build_docker.sh (builds the docker container with all the dependencies)
./run_docker.sh (runs the docker container)
mkdir build 
cd build 
cmake ..
make -j4

Run the code

./test_planner

About

This repo implements AStar planner with path interpolation and smoothening

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published