show
Visualize the planned path
Description
Examples
Plan a collision-free path for a vehicle through a parking lot by using the Hybrid A* algorithm.
Create and Assign Map to State Validator
Load the cost values of cells in the vehicle costmap of a parking lot.
load parkingLotCostVal.mat % costVal
Create a binaryOccupancyMap
with cost values.
resolution = 3; map = binaryOccupancyMap(costVal,resolution);
Create a state space.
ss = stateSpaceSE2;
Update state space bounds to be the same as map limits.
ss.StateBounds = [map.XWorldLimits;map.YWorldLimits;[-pi pi]];
Create a state validator object for collision checking.
sv = validatorOccupancyMap(ss);
Assign the map to the state validator object.
sv.Map = map;
Plan and Visualize Path
Initialize the plannerHybridAStar
object with the state validator object. Specify the MinTurningRadius
and MotionPrimitiveLength
properties of the planner.
planner = plannerHybridAStar(sv, ... MinTurningRadius=4, ... MotionPrimitiveLength=6);
Define start and goal poses for the vehicle as [x, y, theta] vectors. x and y specify the position in meters, and theta specifies the orientation angle in radians.
startPose = [4 9 pi/2]; % [meters, meters, radians]
goalPose = [30 19 -pi/2];
Plan a path from the start pose to the goal pose.
refpath = plan(planner,startPose,goalPose,SearchMode='exhaustive');
Visualize the path using show function.
show(planner)
Input Arguments
Hybrid A* path planner, specified as a plannerHybridAStar
object.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: 'Positions','none'
Display expansion tree option, specified as the comma-separated pair consisting of
'Tree'
and either 'on'
or
'off'
.
Example: show(planner,'Tree','off')
Data Types: string
Display planned path option, specified as the comma-separated pair consisting of
'Path'
and either 'on'
or
'off'
.
Example: show(planner,'Path','off')
Data Types: string
Display the start and goal points, specified as the comma-separated pair
consisting of 'Positions'
and one of the following:
'start'
— Display the start point.'goal'
— Display the goal point.'both'
— Display the start and goal points.'none'
— Do not display any points.
Example: show(planner,'Positions','start')
Data Types: string
Length of heading, specified as positive numeric scalar. No poses will be visualized when this value is set to 0.
Data Types: single
| double
Output Arguments
Version History
Introduced in R2019b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)