Hi,
1. mobileRobotPRM() generates the roadmap, which is a network graph of possible paths in the map based on free and occupied spaces. Your nodes and connections might look different due to the random placement of nodes as it randomly generates nodes and creates connections between these nodes based on the PRM algorithm parameters. 2. findPath uses A* algorithm.
3. Yes, the path generated is optimal, but as said it above the node locations are randomly generated, which can affect your final path between multiple iterations. To address this you can save the random number generation settings using the rng function. An example code is given below
rngState = rng;
prm = mobileRobotPRM(map,100);
startLocation = [2 1];
endLocation = [12 10];
path = findpath(prm,startLocation,endLocation);
show(prm)
rng(rngState);
path = findpath(prm,startLocation,endLocation);
show(prm)
This would return the same paths in both the iterations
Hope this helps!
Best Answer