plan

Find obstacle-free path between two poses

Description

example

path = plan(planner,start,goal) computes an obstacle-free path between start and goal poses, specified as [x y theta] vectors, using the input plannerHybridAStar object.

Examples

collapse all

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.

map = binaryOccupancyMap(costVal);

Create a stateValidator object for collision checking.

validator = validatorOccupancyMap;

Assign the map to the stateValidator object.

validator.Map = map;

Plan and Visualize Path

Initialize the plannerHybridAStar object with the stateValidator object. Specify the MinTurningRadius and MotionPrimitiveLength properties of the planner.

planner = plannerHybridAStar(validator,'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 = [6 10 pi/2]; % [meters, meters, radians]
goalPose = [90 54 -pi/2];

Plan a path from the start pose to the goal pose.

refpath = plan(planner,startPose,goalPose);

Visualize the path using show function

show(planner)

Input Arguments

collapse all

Hybrid A* path planner, specified as a plannerHybridAStar object.

Start location of path, specified as a 1-by-3 vector in the form [x y theta]. x and y specify the position in meters, and theta specifies the orientation angle in radians.

Example: [5 5 pi/2]

Data Types: double

Final location of path, specified as a 1-by-3 vector in the form [x y theta]. x and y specify the position in meters, and theta specifies the orientation angle in radians.

Example: [45 45 pi/4]

Data Types: double

Output Arguments

collapse all

Obstacle-free path, returned as a navPath object.

Introduced in R2019b