Create probabilistic roadmap path planner
mobileRobotPRM object is a roadmap path planner object for
the environment map specified in the
Map property. The object uses the
map to generate a roadmap, which is a network graph of possible paths in the map based on
free and occupied spaces. You can customize the number of nodes,
NumNodes, and the connection distance,
ConnectionDistance, to fit the complexity of the map and find an
obstacle-free path from a start to an end location.
After the map is defined, the
mobileRobotPRM path planner generates
the specified number of nodes throughout the free spaces in the map. A connection between
nodes is made when a line between two nodes contains no obstacles and is within the
specified connection distance.
After defining a start and end location, to find an obstacle-free path using this
network of connections, use the
findpath method. If
findpath does not find a connected path, it returns an empty array.
By increasing the number of nodes or the connection distance, you can improve the
likelihood of finding a connected path, but tuning these properties is necessary. To see
the roadmap and the generated path, use the visualization options in
show. If you change any of the
findpath to recreate the roadmap.
empty roadmap with default properties. Before you can use the roadmap, you must
planner = mobileRobotPRM
binaryOccupancyMap object in the
map — Map representation
Map representation, specified as a
binaryOccupancyMap object. This
object represents the environment of the robot. The object is a matrix grid
with binary values indicating obstacles as
1) and free locations as
numnodes — Maximum number of nodes in roadmap
50 (default) | scalar
Maximum number of nodes in roadmap, specified as a scalar. By increasing this value, the complexity and computation time for the path planner increases.
ConnectionDistance — Maximum distance between two connected nodes
inf (default) | scalar in meters
Maximum distance between two connected nodes, specified as the comma-separated
pair consisting of
"ConnectionDistance" and a scalar in meters.
This property controls whether nodes are connected based on their distance apart.
Nodes are connected only if no obstacles are directly in the path. By decreasing
this value, the number of connections is lowered, but the complexity and
computation time decreases as well.
Map — Map representation
binaryOccupancyMap object |
NumNodes — Number of nodes in the map
50 (default) | scalar
Number of nodes in the map, specified as the comma-separated pair consisting of
"NumNodes" and a scalar. By increasing this value, the
complexity and computation time for the path planner increases.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
map input must be specified on creation of the
Version HistoryIntroduced in R2019b
mobileRobotPRM was renamed
mobileRobotPRM object was renamed from
mobileRobotPRM for all object