plot

Plot path planned by RRT* path planner

Description

example

plot(planner) plots the path planned by the input pathPlannerRRT object. When specified as an input to the plan 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 plan, then plot displays only the costmap of planner.

plot(planner,Name,Value) specifies options using one or more name-value pair arguments. For example, plot(planner,'Tree','on') plots the poses explored by the RRT* path planner.

Examples

collapse all

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.

plot(planner)

Input Arguments

collapse all

RRT* path planner, specified as a pathPlannerRRT object.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is 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 Name1,Value1,...,NameN,ValueN.

Example: 'Vehicle','off'

Axes object in which to draw the plot, specified as the comma-separated pair consisting of 'Parent' and an axes object. If you do not specify Parent, a new figure is created.

Display exploration tree, specified as the comma-separated pair consisting of 'Tree' and 'off' or 'on'. Setting this value to 'on' displays the poses explored by the RRT* path planner, planner.

Display vehicle, specified as the comma-separated pair consisting of 'Vehicle' and 'on' or 'off'. Setting this value to 'off' disables the vehicle displayed along the path planned by the RRT* path planner, planner.

Introduced in R2018a