Main Content

inflate

Inflate each occupied location

Description

example

inflate(map,radius) inflates each occupied location of the map by the radius given in meters. radius is rounded up to the nearest cell equivalent based on the resolution of the map. Every cell within the radius is set to true (1).

Note

inflate does not inflate the locations past the limits of the map.

inflate(map,radius,"grid") inflates each occupied location by the radius given in number of cells.

Examples

collapse all

Create a 10m x 10m empty map.

map = binaryOccupancyMap(10,10,10);

Set occupancy of world locations and show map.

x = [1.2; 2.3; 3.4; 4.5; 5.6];
y = [5.0; 4.0; 3.0; 2.0; 1.0];

setOccupancy(map, [x y], ones(5,1))
figure
show(map)

Inflate occupied locations by a given radius.

inflate(map, 0.5)
figure
show(map)

Get grid locations from world locations.

ij = world2grid(map, [x y]);

Set grid locations to free locations.

setOccupancy(map, ij, zeros(5,1), 'grid')
figure
show(map)

Input Arguments

collapse all

Map representation, specified as a binaryOccupancyMap object. This object represents the environment of the robot. The object contains a matrix grid with binary values indicating obstacles as true (1) and free locations as false (0).

Dimension that defines how much to inflate occupied locations, specified as a scalar. By default the units of radius are meters and each cell is inflated by ceil(map.Resolution*radius) cells.

If you specify the optional argument, "grid", then the unit of radius is grid cells. For example inflate(map,10,"grid") inflates occupied locations by 10 grid cells.

Data Types: double

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2015a