Check occupancy values for locations
Access occupancy values and check their occupancy status based on the occupied and free thresholds of the
Create a matrix and populate it with values. Use this matrix to create an occupancy map.
p = zeros(20,20); p(11:20,11:20) = ones(10,10); map = binaryOccupancyMap(p,10); show(map)
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');
map— Map representation
Map representation, specified as a
xy— Coordinates in the map
Coordinates in the map, specified as an n-by-2 matrix
y] pairs, where n is the
number of coordinates. Coordinates can be world or local coordinates
depending on the syntax.
ij— Grid locations in the map
Grid locations in the map, specified as an n-by-2
j] pairs, where n is the
number of locations. Grid locations are given as
bottomLeft— Location of output matrix in world or local
Location of bottom left corner of output matrix in world or local
coordinates, specified as a two-element vector,
yCoord]. Location is in world or local coordinates based on
matSize— Output matrix size
Output matrix size, specified as a two-element vector,
[gridRow gridCol]. Size is in
world, local, or grid coordinates based on syntax.
topLeft— Location of grid
Location of top left corner of grid, specified as a two-element vector,