Main Content


Plot collision configuration



plot(ccConfig) plots the collision-checking configuration of an InflationCollisionChecker object. Use plot to visually verify that the circles in the configuration fully enclose the vehicle.

plot(ccConfig,Name,Value) specifies options using one or more Name,Value pair arguments. For example, plot(ccConfig,'Ruler','Off') turns off the ruler that indicates the locations of the circle centers.


collapse all

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, ...


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;

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

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

Input Arguments

collapse all

Collision-checking configuration, specified as an InflationCollisionChecker object. To create a collision-checking configuration, use the inflationCollisionChecker function.

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: plot(ccConfig,'Parent',ax) plots the collision configuration in axes ax.

Axes on which to plot the collision configuration, specified as the comma-separated pair consisting of 'Parent' and an Axes object. To create an Axes object, use the axes function.

To plot the collision configuration in a new figure, leave 'Parent' unspecified.

Display the ruler that shows the locations of the circle centers, specified as the comma-separated pair consisting of 'Ruler' and 'on' or 'off'.

Version History

Introduced in R2018b