Set occupancy value of locations
assigns occupancy values,
occval, to the input array of
xy in the occupancy grid,
map. Each row of the array,
a point in the world and is represented as an
occval is either a scalar or a single
column array of the same length as
xy . An occupied
location is represented as
1), and a
free location is represented as
validPts = setOccupancy(___)
n-element vector of logical values indicating
whether input coordinates are within the map limits.
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)
map— Map representation
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
1) and free locations as
xy— World coordinates
World coordinates, specified as an n-by-2 vertical array of
y] pairs, where n is the number of world
ij— Grid positions
Grid positions, specified as an n-by-2 vertical
[i j] pairs in
[rows cols] format,
where n is the number of grid positions.
inputMatrix— Occupancy values
Occupancy values, specified as a matrix. Values are given between 0 and 1 inclusively.
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
topLeft— Location of grid
Location of top left corner of grid, specified as a two-element vector,