Check locations for free, occupied, or unknown values
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 = 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])
pocc = 0.7500
occupied = checkOccupancy(map,[1.5 1])
occupied = 1
pocc2 = getOccupancy(map,[5 5],'grid')
pocc2 = 0.5000
occupied2 = checkOccupancy(map,[5 5],'grid')
occupied2 = -1
map— Map representation
Map representation, specified as a
occupancyMap object. This object
represents the environment of the vehicle. The object contains a matrix grid
with values representing the probability of the occupancy of that cell.
Values close to 1 represent a high certainty that the cell contains an
obstacle. Values close to 0 represent certainty that the cell is not
occupied and obstacle free.
xy— World coordinates
World coordinates, specified as an n-by-2 matrix of
y] pairs, where n is the
number of world coordinates.
ij— Grid positions
Grid positions, specified as an n-by-2 matrix of
j] pairs in
cols] format, where n is
the number of grid positions.
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,
iOccval— Interpreted occupancy values
Occupancy values can be obstacle free (0), occupied (1), or unknown (–1).
These values are determined from the actual probability values and the
FreeThreshold properties of the