**Package: **robotics

Create occupancy grid with probabilistic values

`OccupancyGrid`

creates a 2-D occupancy grid
map. Each cell in the occupancy grid has a value 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.

Occupancy grids are used in robotics algorithms such as path
planning (see `robotics.PRM`

).
They are also used in mapping applications for finding collision-free
paths, performing collision avoidance, and calculating localization
(see `robotics.MonteCarloLocalization`

). You can modify your occupancy grid
to fit your specific application.

The `OccupancyGrid`

objects support world and
grid coordinates. The world coordinates origin is defined by the `GridLocationInWorld`

property
of the object, which defines the bottom-left corner of the grid. The
number and size of grid locations are defined by the `Resolution`

property.
The first grid location with index `(1,1)`

begins
in the top-left corner of the grid.

Use the `OccupancyGrid`

class to create 2-D
maps of an environment with probability values representing different
obstacles in your world. You can specify exact probability values
of cells or include observations from sensors such as laser scanners.

Probability values are stored using a binary Bayes filter to estimate the occupancy
of each grid cell. A log-odds representation is used, with values
stored as `int16`

to reduce the map storage size
and allow for real-time applications.

If memory size is a limitation, consider using `robotics.BinaryOccupancyGrid`

instead.
The binary occupancy grid uses less memory with binary values, but
still works with Robotics System
Toolbox™ algorithms and other applications.

creates
a 2-D occupancy grid object representing a world space of `map`

= robotics.OccupancyGrid(`width`

,`height`

)`width`

and `height`

in
meters. The default grid resolution is 1 cell per meter.

creates
an occupancy grid with a specified grid resolution in cells per meter.`map`

= robotics.OccupancyGrid(`width`

,`height`

,`resolution`

)

creates an occupancy grid with the specified number of rows and columns and with the
resolution in cells per meter.`map`

= robotics.OccupancyGrid(rows,cols,`resolution`

,"grid")

creates
an occupancy grid from the values in matrix `map`

= robotics.OccupancyGrid(`p`

)`p`

.
The grid size matches the size of the matrix, with each cell probability
value interpreted from the matrix location.

creates
an occupancy grid from the specified matrix and resolution in cells
per meter.`map`

= robotics.OccupancyGrid(`p`

,`resolution`

)

checkOccupancy | Check locations for free, occupied, or unknown values |

copy | Create copy of occupancy grid |

getOccupancy | Get occupancy of a location |

grid2world | Convert grid indices to world coordinates |

inflate | Inflate each occupied grid location |

insertRay | Insert ray from laser scan observation |

occupancyMatrix | Convert occupancy grid to double matrix |

rayIntersection | Compute map intersection points of rays |

raycast | Compute cell indices along a ray |

setOccupancy | Set occupancy of a location |

show | Show grid values in a figure |

updateOccupancy | Integrate probability observation at a location |

world2grid | Convert world coordinates to grid indices |

Occupancy values have a limited resolution of ±0.001. The
values are stored as `int16`

using a log-odds representation.
This data type limits resolution, but saves you memory when storing
large maps in MATLAB^{®}. When calling `set`

and
then `get`

, the value returned might not equal the
value you set. For more information, see the log-odds representations
section in Occupancy Grids.

`readOccupancyGrid`

| `robotics.BinaryOccupancyGrid`

| `robotics.PRM`

| `robotics.PurePursuit`

| `writeOccupancyGrid`