A* path planning Algorithm / C++ source code










Created Date : 2010.8
Language : C/C++
Tool : Microsoft Visual C++ 6.0
Library & Utilized : STL
Reference : A* internet reference
etc. : map(.txt file)




It is A* algorithm. A* is known as good path plan algorithm in the Game and other fields.
I made the A* algorithm program. I have refered a lot of reference in the internet. You also can get materials easily in the internet.

I made the algorithm to class type. So we can use the A* Class like this;

CAstar Astar;
Astar.MapCopy(xSize, ySize, &map);
Astar.SetSEpoint(sX, sY, eX, eY);
vector< pair<int, int > > path = Astar.FindPath();

map variable type is 'int ** map'.
sX, Sy is start coordinate. eX, ey is  end coordinate.
The path coordinate is saved in the path variable(vector type).

You can download this <source code>.
And I wish to leave your valueable comment.

Thank you.

Comments

  1. Anonymous4/5/14 08:41

    Thanks for the example, but it is underlining this sentence "if( fin == NULL)", the error message as follow: "Error 3 error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::ifstream' (or there is no acceptable conversion) c:\users\My_PC\downloads\a_star\main.cpp 74 1 A_Star"

    ReplyDelete

Post a Comment

Popular posts from this blog

OpenCV Stitching example (Stitcher class, Panorama)

(OpenCV Study) Background subtractor MOG, MOG2, GMG example source code (BackgroundSubtractorMOG, BackgroundSubtractorMOG2, BackgroundSubtractorGMG)

Example source code of extract HOG feature from images, save descriptor values to xml file, using opencv (using HOGDescriptor )

Real-time N camera stitching Class.

8 point algorithm (Matlab source code) / The method to get the Fundamental Matrix and the Essential matrix

Optical Flow sample source code using OpenCV

Video Stabilization example source code, (using cvFindHomography, cvWarpPerspective functions in openCV)

(OpenCV Study) calcOpticalFlowFarneback example source code ( dense optical flow )

yuv422(YUYV) to RGB and RGB to yuv422(YUYV), (Using OpenCV and TBB)

OpenCV Drawing Example, (line, circle, rectangle, ellipse, polyline, fillConvexPoly, putText, drawContours)