Main Content

plot

Plot collision configuration

Description

example

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.

Examples

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, ...
    'CenterPlacements',centerPlacements,'InflationRadius',inflationRadius);

figure
plot(ccConfig)

Figure contains an axes object. The axes object 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 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);

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 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: 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'.

Introduced in R2018b