%% Get Occupancy Values and Check Occupancy Status
% Access occupancy values and check their occupancy status based on the occupied and free thresholds of the occupancyMap object.
% Create a matrix and populate it with values. Use this matrix to create an occupancy map.

p = 0.5*ones(20,20);
p(11:20,11:20) = 0.75*ones(10,10);
map = occupancyMap(p,10);

%
% Get the occupancy of different locations and check their occupancy statuses. The occupancy status returns 0 for free space and 1 for occupied space. Unknown values return –1.

pocc = getOccupancy(map,[1.5 1])
occupied = checkOccupancy(map,[1.5 1])

pocc2 = getOccupancy(map,[5 5],'grid')
occupied2 = checkOccupancy(map,[5 5],'grid')

% Copyright 2019 The MathWorks, Inc.