GridMap#
A grid map discretizes a portion of space, holding values in an Eigen matrix.
Construct a grid map, storing values in an internal
Map
.- Parameters:
width – The width of the map in number of cells
height – The height of the map in number of cells
resolution – The resolution: size of one cell in meters.
origin – The position of the left-bottom corner of the map in meters.
Checks whether the map contains a point.
- Parameters:
point – The point
- Returns:
True if the point is covered by the map.
Gets the indices corresponding to a cell at a given position.
When the cell lies outside of the map, it either returns unbounded indices (
clamp=false
) or clamp them (clamp=false
).- Parameters:
position – The position
clamp – Whether to clamp
- Returns:
The cell.
Gets the position of a the center of a cell
Does not check whether the cell is contained or not in the map.
- Parameters:
cell – The cell indices
- Returns:
The position in meters
Gets the indices corresponding to a cell at a given position.
- Parameters:
position – The position
- Returns:
The cell or null if the cell lies outside of the map.
Moves the center of the map.
When snap is enabled, it constraints moves by multiple of the cell size.
- Parameters:
position – The desired center position
value – The cell value set in regions not previously covered by the map.
snap – Whether to snap movements to the grid.
Moves the origin of the map.
When snap is enabled, it constraints moves by multiple of the cell size.
- Parameters:
position – The desired origin (bottom-left corner) position
value – The cell value set in regions not previously covered by the map.
snap – Whether to snap movements to the grid.
Applies a function for each cell along a line between two cells using Bresenham’s line algorithms.
If the line has less than
min_length
cells, it will be ignored. If the line has more thanmax_length
cells, it will be clipped.- Parameters:
at – The function
c1 – The cell at one vertex
c2 – The cell at the other vertex
max_length – The maximum number of cells
min_length – The minimum number of cells
Sets the value of all cells.
- Parameters:
value – The value
Sets the value of the cell at a location.
- Parameters:
point – The cell location in meters
value – The value
Sets the value of all cells along a line between two cells
- Parameters:
c1 – The cell at one vertex
c2 – The cell at the other vertex
value – The value
Sets the value of all cells in a disc
- Parameters:
center – The center of the disc in meters
radius – The radius of the disc in meters
value – The value
Sets the value of all cells in a spatial rectangle
- Parameters:
bottom_left – The bottom-left corner in meters
width – The rectangle width in meters
height – The rectangle height in meters
value – The value
Sets the value of a single cell.
- Parameters:
cell – The cell
value – The value
Sets the value of all cells along a line between to points.
- Parameters:
p1 – The line vertex in meters
p2 – The other line vertex in meters
value – The value
- Type:
The position of the bottom-left corner of the map in meters.
- Type:
The position of the center of the map in meters.
- Type:
The number of rows.
- Type:
numpy.ndarray[numpy.uint8[m, n], flags.writeable, flags.c_contiguous]
Returns a constant reference to the map.
- Type:
The position of the bottom-left corner of the map in meters.
- Type:
The size of one cell in meters.
- Type:
The position of the top-right corner of the map in meters.
- Type:
The number of columns.