GridMap#
#include "navground/core/states/gridmap.h"
- A grid map discretizes a portion of space, holding values in an Eigen matrix. - Public Types - An Eigen array, holding the grid map values. 
 - An Eigen map, holding the grid map values. 
 - The indices of a cell 
 - An action to be applied to a cell during raytracing. 
 - Public Functions - Construct a grid map, storing values locally. - Parameters:
- width – [in] The width of the map in number of cells 
- height – [in] The height of the map in number of cells 
- resolution – [in] The resolution: size of one cell in meters. 
- origin – [in] The position of the left-bottom corner of the map in meters. 
 
 
 - Construct a grid map, linking external values. - Parameters:
- data – [in] A valid pointer to at least at least width x height values. 
- width – [in] The width of the map in number of cells 
- height – [in] The height of the map in number of cells 
- resolution – [in] The resolution: size of one cell in meters. 
- origin – [in] The position of the left-bottom corner of the map in meters. 
 
 
 - Gets the position of the bottom-left corner of the map in meters. - Returns:
- The left-bottom position. 
 
 - Sets the the position of the bottom-left corner of the map in meters. - Parameters:
- value – [in] The desired value 
 
 - Gets the position of the top-right corner of the map in meters. - Returns:
- The top-right position. 
 
 - Gets the position of the bottom-left corner of the map in meters. - Returns:
- The left-bottom position. 
 
 - Gets the position of the center of the map in meters. - Returns:
- The center. 
 
 - Sets the position of the center of the map in meters. - Parameters:
- value – [in] The desired value 
 
 - Gets the size of one cell in meters. - Returns:
- The resolution. 
 
 - Sets the size of one cell in meters. - Parameters:
- value – [in] The desired positive value 
 
 - Gets the number of columns. - Returns:
- The width. 
 
 - Sets the number of columns. - Will resize the map if needed. - Parameters:
- value – A positive value 
 
 - Gets the number of rows. - Returns:
- The height. 
 
 - Sets the number of rows. - Will resize the map if needed. - Parameters:
- value – A positive value 
 
 - Returns a constant reference to the map. - Returns:
- The map. 
 
 - Returns a reference to the map. - Returns:
- The map. 
 
 - 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 – [in] The cell indices 
- Returns:
- The position in meters 
 
 - Gets the indices corresponding to a cell at a given position. - Parameters:
- position – [in] The position 
- Returns:
- The cell or null if the cell lies outside of 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 – [in] The position 
- clamp – [in] Whether to clamp 
 
- Returns:
- The cell. 
 
 - Checks whether the map contains a point. - Parameters:
- point – [in] The point 
- Returns:
- True if the point is covered by the map. 
 
 - Moves the center of the map. - When snap is enabled, it constraints moves by multiple of the cell size. - Parameters:
- position – [in] The desired center position 
- value – [in] The cell value set in regions not previously covered by the map. 
- snap – [in] 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 – [in] The desired origin (bottom-left corner) position 
- value – [in] The cell value set in regions not previously covered by the map. 
- snap – [in] Whether to snap movements to the grid. 
 
 
 - Sets the value of all cells. - Parameters:
- value – [in] The value 
 
 - Sets the value of a single cell. - Parameters:
- cell – [in] The cell 
- value – [in] The value 
 
 
 - Sets the value of the cell at a location. - Parameters:
- point – [in] The cell location in meters 
- value – [in] The value 
 
 
 - Sets the value of all cells in a spatial rectangle. - Parameters:
- bottom_left – [in] The bottom-left corner in meters 
- width – [in] The rectangle width in meters 
- height – [in] The rectangle height in meters 
- value – [in] The value 
 
 
 - Sets the value of all cells in a disc. - Parameters:
- center – [in] The center of the disc in meters 
- radius – [in] The radius of the disc in meters 
- value – [in] The value 
 
 
 - Sets the value of all cells along a line between to points. - Parameters:
- p1 – [in] The line vertex in meters 
- p2 – [in] The other line vertex in meters 
- value – [in] The value 
 
 
 - Sets the value of all cells along a line between two cells. - Parameters:
- c1 – [in] The cell at one vertex 
- c2 – [in] The cell at the other vertex 
- value – [in] The value 
 
 
 - Applies a function for each cell along a line between two cells using Bresenham’s line algorithms. - If the line has less than - min_lengthcells, it will be ignored. If the line has more than- max_lengthcells, it will be clipped.- Parameters:
- at – [in] The function 
- c1 – [in] The cell at one vertex 
- c2 – [in] The cell at the other vertex 
- max_length – [in] The maximum number of cells 
- min_length – [in] The minimum number of cells