Given a distance transform of a map with obstacles in it, how do I get the least cost path from a start pixel to a goal pixel? The distance transform image has the distance(euclidean) to the nearest obstacle of the original map, in each pixel i.e. if in the original map pixel (i,j) is 3 pixels away to the left and 2 pixels away to the down of an obstacle, then in the distance transform the pixel will have sqrt(4+9) = sqrt(13) as the pixel value. Thus darker pixels signify proximity to obstacles and lighter values signify that they are far from obstacles.
I want to plan a path from a given start to goal pixel using the information provided by this distance transform and optimize the cost of the path and also there is another constraint that the path should never reach a pixel which is less than 'x' pixels away from an obstacle.
How do I go about this?
P.S. A bit of description on the algorithm (or a bit of code) would be helpful as I am new to planning algorithms.
I found an algorithm in the appendix I of the chapter titled
JARVIS, Ray. Distance transform based path planning for robot navigation. Recent trends in mobile robots, 1993, 11: 3-31.
That chapter is fully visible to me in Google books and the book is
ZHENG, Yuang F. (ed.). Recent trends in mobile robots. World Scientific, 1993.
A C++ implementation of the algorithm follows:
The algorithm uses the simple PPM image format explained for example in the Chapter 15 from the book Computer Graphics: Principles and Practice - Third Edition by Hughes et al. in order to save the images.
The algorithm starts from the image of the obstacles (
blocked
) and computes from it the distance transform (cell
); then, starting from the distance transform, it computes the optimal path with a steepest descent method: it walks downhill in the transform distance potential field. So you can start from your own distance transform image.Please note that it seems to me that the algorithm does not fulfill your additional constraint that:
The following png image is the image of the obstacles, the program generated
blocked.ppm
image was exported as png via Gimp:The following png image is the image of the start point, the program generated
start.ppm
image was exported as png via Gimp:The following png image is the image of the end point, the program generated
goal.ppm
image was exported as png via Gimp:The following png image is the image of the computed path, the program generated
path.ppm
image was exported as png via Gimp:The following png image is the image of the distance transform, the program generated
cell.ppm
image was exported as png via Gimp:I found the Jarvis' article after having a look at
CHIN, Yew Tuck, et al. Vision guided agv using distance transform. In: Proceedings of the 32nd ISR (International Symposium on Robotics). 2001. p. 21.
Update:
The Jarvis' algorithm is reviewed in the following paper where the authors state that:
ELIZONDO-LEAL, Juan Carlos; PARRA-GONZÁLEZ, Ezra Federico; RAMÍREZ-TORRES, José Gabriel. The Exact Euclidean Distance Transform: A New Algorithm for Universal Path Planning. Int J Adv Robotic Sy, 2013, 10.266.