mapLayer
Description
The mapLayer
object creates an N-dimensional
grid map, where the first two dimensions determine the footprint of the map, and all
subsequent dimensions dictate the size and layout of the data stored in each cell. For storing
scalar binary or probability values for a grid map, use the binaryOccupancyMap
or occupancyMap
objects instead.
A map layer stores data for grid cells that represent a discretized region of space. To
query and update data using world, local, or grid coordinates, use the getMapData
and
setMapData
object
functions. Each grid cell in the map can store data of any size from a single a value to a
multi-dimensional array. For more information, see the DataSize
property.
Layer behavior can also be customized by providing function handles during creation using
the GetTransformFcn
and SetTransformFcn
properties.
Creation
Syntax
Description
creates an empty map object
occupying 10-by-10 meters of space with a resolution of 1 cell per meter.map
= mapLayer
creates a map from the values in the matrix or matrix array map
= mapLayer(p
)p
. For
3-D matrix arrays, each cell in the map is filled with the vector of values at each grid
location along the third dimension of the array. For an
N-by-D matrix array, each cell contains a matrix
(N=4) or a matrix array (N>4) of data for that
grid location.
creates a map covering the specified width and height with a resolution of 1 cell per
meter.map
= mapLayer(width
,height
)
creates a map with a grid size of map
= mapLayer(rows
,cols
,'grid')rows
,cols
with a resolution of 1 cell per meter.
creates the map where the size of the data stored in each cell is defined by the array
of integers map
= mapLayer(width
,height
,cellDims
)cellDims
.
creates a map with a grid size of map
= mapLayer(rows
,cols
,cellDims
,'grid')rows
cols
where the size of the data stored in each cell is defined by the array of integers
cellDims
.
creates a new object using the layers copied from another map
= mapLayer(sourceMap
)mapLayer
object.
specifies property values using name-value pairs. map
= mapLayer(___,Name,Value
)
For example, mapLayer(__,'LocalOriginInWorld',[15 20])
sets the
local origin to a specific world location.
Properties
Object Functions
getMapData | Retrieve data from map layer |
grid2local | Convert grid indices to local coordinates |
grid2world | Convert grid indices to world coordinates |
local2grid | Convert local coordinates to grid indices |
local2world | Convert local coordinates to world coordinates |
move | Move map in world frame |
setMapData | Assign data to map layer |
syncWith | Sync map with overlapping map |
world2grid | Convert world coordinates to grid indices |
world2local | Convert world coordinates to local coordinates |
Examples
Limitations
mapLayer
objects can only belong to onemultiLayerMap
object at a time.
Extended Capabilities
Version History
Introduced in R2021a