%% Inflate Obstacles in an Occupancy Grid
% This example shows how the inflate method performs probabilistic inflation on obstacles to inflate their size and create a buffer zone for areas with a higher probability of obstacles.
% Create a 10m x 10m empty map.

map = occupancyMap(10,10,10);

%
% Update occupancy of world locations with specific values in pvalues.

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

pvalues = [0.2 0.4 0.6 0.8 1];

updateOccupancy(map,[x y],pvalues)
figure
show(map)

%
% Inflate occupied areas by a given radius. Larger occupancy values are written over smaller values. You can copy your map beforehand to revert any unwanted changes.

savedMap = copy(map);
inflate(map,0.5)
figure
show(map)

% Copyright 2019 The MathWorks, Inc.