28#ifndef SRC_LOCALGRID_H_
29#define SRC_LOCALGRID_H_
31#include "rtabmap/core/rtabmap_core_export.h"
33#include <opencv2/core.hpp>
73 const cv::Mat & obstacles,
74 const cv::Mat & empty,
76 const cv::Point3f & viewPoint = cv::Point3f(0,0,0));
105 const cv::Mat & ground,
106 const cv::Mat & obstacles,
107 const cv::Mat & empty,
109 const cv::Point3f & viewPoint = cv::Point3f(0,0,0));
127 void clear(
bool temporaryOnly =
false);
129 size_t size()
const {
return localGrids_.size();}
130 bool empty()
const {
return localGrids_.empty();}
131 const std::map<int, LocalGrid> & localGrids()
const {
return localGrids_;}
133 std::map<int, LocalGrid>::const_iterator find(
int nodeId)
const {
return localGrids_.find(nodeId);}
134 std::map<int, LocalGrid>::const_iterator begin()
const {
return localGrids_.begin();}
135 std::map<int, LocalGrid>::const_iterator end()
const {
return localGrids_.end();}
138 std::map<int, LocalGrid> localGrids_;
Cache of LocalGrid entries keyed by map node id.
void add(int nodeId, const cv::Mat &ground, const cv::Mat &obstacles, const cv::Mat &empty, float cellSize, const cv::Point3f &viewPoint=cv::Point3f(0, 0, 0))
Inserts or replaces the grid for nodeId (from separate cell mats).
void clear(bool temporaryOnly=false)
Removes cached grids.
bool shareTo(int nodeId, LocalGridCache &anotherCache) const
Copies a grid to anotherCache if present here and absent there.
void add(int nodeId, const LocalGrid &localGrid)
Inserts or replaces the grid for nodeId.
unsigned long getMemoryUsed() const
Approximate memory used by cached grids (bytes).
Local occupancy grid cells for one map node (ground, obstacles, empty).
float cellSize
Cell size in meters.
cv::Mat groundCells
Ground cells (1×N, CV_32FC2–CV_32FC7, see class doc).
LocalGrid(const cv::Mat &ground, const cv::Mat &obstacles, const cv::Mat &empty, float cellSize, const cv::Point3f &viewPoint=cv::Point3f(0, 0, 0))
Builds a local grid from cell matrices.
cv::Mat emptyCells
Empty/free cells (same layout as groundCells).
cv::Point3f viewPoint
View point used to build the grid.
cv::Mat obstacleCells
Obstacle cells (same layout as groundCells).