Hi, I was trying out the Robotics System Toolbox and the path planning tutorial for mobile robots. I have a few questions in mind that I hope someone would be able to clarify. How are the nodes positioned according to mobileRobotPRM()? I found it rather random which resulted in different paths every time the program is run. Which algorithm is used in findPath()? I can't find it in Matlab documentation. In every iteration findPath() returns a different path for the same map, initial location and goal. It either means it's selecting a random path based on the connected nodes instead of the optimised path or its providing an optimum path but due to the random node generation by mobileRobotPRM(), the path differs everytime. Is there a way to determine the most optimal path or atleast to get the same path every time the program is run?
Prashant Kumar answered .
2025-11-20
rngState = rng; prm = mobileRobotPRM(map,100); startLocation = [2 1]; endLocation = [12 10]; % first iteration path = findpath(prm,startLocation,endLocation); show(prm) % second iteration rng(rngState); path = findpath(prm,startLocation,endLocation); show(prm)