path = plan(planner,start,goal)
finds the shortest obstacle-free path, path, between a specified start
point, start, and goal point, goal, specified as
[row column] in grid frame with origin at top-left corner, using the
specified A* path planner planner.
path = plan(planner,start,goal,'world')
finds the shortest obstacle-free path, path, between a specified start
point, start, and goal point, goal, specified as
[x y] in world coordinate frame with origin at bottom-left corner,
using the specified A* path planner planner.
[path,debugInfo] = plan(___)
also returns debugInfo that contains the path cost, number of nodes
explored, and GCost for each explored node.
planner — A* path planner for grid map plannerAStarGrid object
A* path planner for a grid map, specified as a plannerAStarGrid
object.
start — Start position in grid or world two-element vector
Start position in the grid or world, specified as a two-element vector of the form
[rowcolumn], or [xy]. The location is in grid positions or world coordinates based on
syntax.
Example: [2 3]
Data Types: double
goal — Goal position in grid or world two-element vector
Goal position in the grid or world, specified as a two-element vector of the form
[rowcolumn], or [xy]. The location is in grid positions or world coordinates based on
syntax.
Shortest obstacle-free path, returned as an n-by-2 matrix.
n is the number of waypoints in the path. Each row represents the
[rowcolumn], or [xy] location of a waypoint along the solved path from the start
location to the goal. The location is in grid positions or world coordinates based on
syntax.
Data Types: double
debugInfo — Debugging information for path result structure
Debugging information for the path result, returned as a structure with these fields:
PathCost — Cost of the path
NumNodesExplored — Number of nodes explored
GCostMatrix — GCost for each explored node
Data Types: struct
Extended Capabilities
C/C++ Code Generation Generate C and C++ code using MATLAB® Coder™.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.