Plot path planned by RRT* path planner
plot( plots the path planned by
pathPlannerRRT object. When specified as an input to the
function, this object plans a path using the rapidly exploring random tree (RRT*)
algorithm. If a path has not been planned using
plan, or if
properties of the
pathPlannerRRT planner have changed since using
plot displays only the costmap
Plan a vehicle path to a parking spot by using the RRT* algorithm.
Load a costmap of a parking lot. Plot the costmap to see the parking lot and inflated areas for the vehicle to avoid.
data = load('parkingLotCostmapReducedInflation.mat'); costmap = data.parkingLotCostmapReducedInflation; plot(costmap)
Define start and goal poses for the path planner as [x, y, Θ] vectors. World units for the (x,y) locations are in meters. World units for the Θ orientation values are in degrees.
startPose = [11, 10, 0]; % [meters, meters, degrees] goalPose = [31.5, 17, 90];
Create an RRT* path planner to plan a path from the start pose to the goal pose.
planner = pathPlannerRRT(costmap); refPath = plan(planner,startPose,goalPose);
Plot the planned path.
planner— RRT* path planner
RRT* path planner, specified as a
comma-separated pairs of
the argument name and
Value is the corresponding value.
Name must appear inside quotes. You can specify several name and value
pair arguments in any order as
Parent— Axes object
Axes object in which to draw the plot, specified as the
comma-separated pair consisting of
'Parent' and an
axes object. If you do
Parent, a new figure is created.
Tree— Display exploration tree
Display exploration tree, specified as the comma-separated pair
'on'. Setting this value to
'on' displays the poses explored by the RRT* path
Vehicle— Display vehicle
Display vehicle, specified as the comma-separated pair consisting of
'off'. Setting this value to
'off' disables the vehicle displayed along the
path planned by the RRT* path planner,