Alpheron
New Coder
Hello Everyone,
I was recently working on a project where I would be given an image of a field in which a robot would traverse and find the optimal path given a start point and endpoint. I was thinking of using converting the image to 1's and 0's depending on an obstacle's positioning on the field and the resolution of which standard of measurement will be used (ie. inch, half-inch). With this field of 1's and 0's, I was thinking of running A* on it in order to find the optimal path between the start point and endpoint. My current implementation of this algorithm can be found here. However, I have seen other's use obstacle classes in order to define obstacles and their positions on the field. Along with the node class. When running my code, it seems to work fine for avoiding obstacles however if there is no path between the start point and the endpoint, the algorithm seems to go haywire and come up with a random path. How would I be able to solve this problem and perhaps improve my implementation?
Thanks in advance!
I was recently working on a project where I would be given an image of a field in which a robot would traverse and find the optimal path given a start point and endpoint. I was thinking of using converting the image to 1's and 0's depending on an obstacle's positioning on the field and the resolution of which standard of measurement will be used (ie. inch, half-inch). With this field of 1's and 0's, I was thinking of running A* on it in order to find the optimal path between the start point and endpoint. My current implementation of this algorithm can be found here. However, I have seen other's use obstacle classes in order to define obstacles and their positions on the field. Along with the node class. When running my code, it seems to work fine for avoiding obstacles however if there is no path between the start point and the endpoint, the algorithm seems to go haywire and come up with a random path. How would I be able to solve this problem and perhaps improve my implementation?
Thanks in advance!