Main Content

inflationCollisionChecker

Collision-checking configuration for costmap based on inflation

Description

The inflationCollisionChecker function creates an InflationCollisionChecker object, which holds the collision-checking configuration of a vehicle costmap. A vehicle costmap with this configuration inflates the size of obstacles in the vehicle environment. This inflation is based on the specified InflationCollisionChecker properties, such as the dimensions of the vehicle and the radius of circles required to enclose the vehicle. For more details, see Algorithms. Path planning algorithms, such as pathPlannerRRT, use this costmap collision-checking configuration to avoid inflated obstacles and plan collision-free paths through an environment.

Use the InflationCollisionChecker object to set the CollisionChecker property of your vehicleCostmap object. This collision-checking configuration affects the return values of the checkFree and checkOccupied functions used by vehicleCostmap. These values indicate whether a vehicle pose is free or occupied.

Creation

Description

ccConfig = inflationCollisionChecker creates an InflationCollisionChecker object, ccConfig, that holds the collision-checking configuration of a vehicle costmap. This object uses one circle to enclose the vehicle. The dimensions of the vehicle correspond to the values of a default vehicleDimensions object.

ccConfig = inflationCollisionChecker(vehicleDims) specifies the dimensions of the vehicle, where vehicleDims is a vehicleDimensions object. The vehicleDims input sets the VehicleDimensions property of ccConfig.

example

ccConfig = inflationCollisionChecker(vehicleDims,numCircles) also specifies the number of circles used to enclose the vehicle. The numCircles input sets the NumCircles property of ccConfig.

example

ccConfig = inflationCollisionChecker(___,Name,Value) sets the CenterPlacements and InflationRadius properties using name-value pairs and the inputs from any of the preceding syntaxes. Enclose each property name in quotes.

Example: inflationCollisionChecker('CenterPlacements',[0.2 0.5 0.8],'InflationRadius',1.2)

Properties

expand all

Number of circles used to enclose the vehicle and calculate the inflation radius, specified as a positive integer. Typical values are from 1 to 5.

  • For faster but more conservative collision checking, decrease the number of circles. This approach improves performance because the path planning algorithm makes fewer collision checks.

  • For slower but more precise collision checking, increase the number of circles. This approach is useful when planning a path around tight corners or through narrow corridors, such as in a parking lot.

Normalized placement of circle centers along the longitudinal axis of the vehicle, specified as a 1-by-NumCircles vector of real values in the range [0, 1].

  • A value of 0 places a circle center at the rear of the vehicle.

  • A value of 1 places a circle center at the front of the vehicle.

Vehicle with red circles placed at values 0 and 1

Specify CenterPlacements when you want to align the circles with exact positions on the vehicle. If you leave CenterPlacements unspecified, the object computes the center placements so that the circles completely enclose the vehicle. If you change the number of center placements, NumCircles is updated to the number of elements in CenterPlacements.

Vehicle dimensions used to compute the inflation radius, specified as a vehicleDimensions object. By default, the InflationCollisionChecker object uses the dimensions of a default vehicleDimensions object. Vehicle dimensions are in world units.

Inflation radius, specified as a nonnegative real number. By default, the object computes the inflation radius based on the values of NumCircles, CenterPlacements, and VehicleDimensions. For more details, see Algorithms.

Object Functions

plotPlot collision configuration

Examples

collapse all

Plan a vehicle path to a narrow parking spot by using the optimized rapidly exploring random tree (RRT*) algorithm. Try different collision-checking configurations in the costmap used by the RRT* path planner.

Load and display a costmap of a parking lot. The costmap is a vehicleCostmap object. By default, vehicleCostmap uses a collision-checking configuration that inflates obstacles based on a radius of only one circle enclosing the vehicle. The costmap overinflates the obstacles (the parking spot boundaries).

data = load('parkingLotCostmap.mat');
costmap = data.parkingLotCostmap;

figure
plot(costmap)
title('Collision Checking with One Circle')

Figure contains an axes object. The axes object with title Collision Checking with One Circle, xlabel X, ylabel Y contains 2 objects of type image, patch. This object represents Inflated Areas.

Use inflationCollisionChecker to create a new collision-checking configuration for the costmap.

  • To decrease inflation of the obstacles, increase the number of circles enclosing the vehicle.

  • To specify the dimensions of the vehicle, use a vehicleDimensions object.

Specify the collision-checking configuration in the CollisionChecker property of the costmap.

vehicleDims = vehicleDimensions(4.5,1.7);  % 4.5 m long, 1.7 m wide
numCircles = 3;
ccConfig = inflationCollisionChecker(vehicleDims,numCircles);
costmap.CollisionChecker = ccConfig;

Display the costmap with the new collision-checking configuration. The inflated areas are reduced.

figure
plot(costmap)
title('Collision Checking with Three Circles')

Figure contains an axes object. The axes object with title Collision Checking with Three Circles, xlabel X, ylabel Y contains 2 objects of type image, patch. This object represents Inflated Areas.

Define a planning problem: a vehicle starts near the left entrance of the parking lot and ends in a parking spot.

startPose = [11 10 0];   % [meters, meters, degrees]
goalPose = [31.5 17 90]; 

Use a pathPlannerRRT object to plan a path to the parking spot. Plot the planned path.

planner = pathPlannerRRT(costmap);
refPath = plan(planner,startPose,goalPose);

hold on
plot(refPath)
hold off

Figure contains an axes object. The axes object with title Collision Checking with Three Circles, xlabel X, ylabel Y contains 11 objects of type image, patch, scatter, line, polygon. This object represents Inflated Areas.

Create a collision-checking configuration for a costmap. Manually specify the circle centers so that they fully enclose the vehicle.

Define the dimensions of a vehicle by using a vehicleDimensions object.

length = 5; % meters
width = 2; % meters
vehicleDims = vehicleDimensions(length,width);

Define three circle centers and the inflation radius to use for collision checking. Place one center at the vehicle's midpoint. Offset the other two centers by an equal amount on either end of the vehicle.

distFromSide = 0.175;
centerPlacements = [distFromSide 0.5 1-distFromSide];
inflationRadius = 1.2;

Create and display the collision-checking configuration.

ccConfig = inflationCollisionChecker(vehicleDims, ...
    'CenterPlacements',centerPlacements,'InflationRadius',inflationRadius);

figure
plot(ccConfig)

Figure contains an axes object. The axes object with xlabel Longitudinal vehicle axis, ylabel Lateral vehicle axis contains 20 objects of type line, polygon, scatter, text. These objects represent Circle, Circle centers.

In this configuration, the corners of the vehicle are not enclosed within the circles. To fully enclose the vehicle, increase the inflation radius. Display the updated configuration.

ccConfig.InflationRadius = 1.3;
plot(ccConfig)

Figure contains an axes object. The axes object with xlabel Longitudinal vehicle axis, ylabel Lateral vehicle axis contains 20 objects of type line, polygon, scatter, text. These objects represent Circle, Circle centers.

Use this collision-checking configuration to create a 10-by-20 meter costmap.

costmap = vehicleCostmap(10,20,0.1,'CollisionChecker',ccConfig);

Tips

  • To visually verify that the circles completely enclose the vehicle, use the plot function. If the circles do not completely enclose the vehicle, some of the free poses returned by checkFree (or unoccupied poses returned by checkOccupied) might actually be in collision.

Algorithms

The InflationRadius property of InflationCollisionChecker determines the amount, in world units, by which to inflate obstacles. By default, InflationRadius is equal to the radius of the smallest set of overlapping circles required to completely enclose the vehicle, as determined by the following properties:

Vehicle with three circle centers

For more details about how this collision-checking configuration defines inflated areas in a costmap, see the Algorithms section of vehicleCostmap.

References

[1] Ziegler, J., and C. Stiller. "Fast Collision Checking for Intelligent Vehicle Motion Planning." IEEE Intelligent Vehicle Symposium. June 21–24, 2010.

Extended Capabilities

Version History

Introduced in R2018b