21#include <unordered_map>
24#include "Eigen/Eigenvalues"
30namespace localization {
32namespace pyramid_map {
49 size_t CreateBinary(
unsigned char* buf,
size_t buf_size)
const;
59 void AddSample(
const float intensity,
const float altitude,
60 const Eigen::Vector3f& centroid,
bool is_road =
false);
63 void MergeCell(
const float intensity,
const float intensity_var,
64 const unsigned int road_pt_count,
const unsigned int count,
65 const Eigen::Vector3f& centroid,
66 const Eigen::Matrix3f& centroid_cov);
72 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
104 int AddSample(
const float intensity,
const float altitude,
105 const float resolution,
const Eigen::Vector3f& centroid,
106 bool is_road =
false);
116 size_t CreateBinary(
unsigned char* buf,
size_t buf_size)
const;
124 static float CalAltitude(
const float resolution,
const int altitude_index);
131 std::unordered_map<int, NdtMapSingleCell>
cells_;
153 virtual void Reset();
156 void Init(
unsigned int rows,
unsigned int cols);
158 void Reset(
unsigned int rows,
unsigned int cols);
162 virtual size_t LoadBinary(
const unsigned char* buf);
167 virtual size_t CreateBinary(
unsigned char* buf,
size_t buf_size)
const;
175 unsigned int col)
const {
178 return map3d_cells_[row * cols_ + col];
184 return map3d_cells_[row * cols_ + col];
187 unsigned int GetRows()
const {
return rows_; }
189 unsigned int GetCols()
const {
return cols_; }
200 std::unique_ptr<NdtMapCells[]> map3d_cells_;
The options of the reflectance map.
The data structure of the map cells in a map node.
The data structure of ndt Map cell.
int AddSample(const float intensity, const float altitude, const float resolution, const Eigen::Vector3f ¢roid, bool is_road=false)
Add an sample.
int min_altitude_index_
The index of smallest altitude.
void Reset()
Reset to default value.
int max_altitude_index_
The index of biggest altitude.
static int CalAltitudeIndex(const float resolution, const float altitude)
Calculate altitude index from altitude.
NdtMapCells()
The default constructor.
std::vector< int > road_cell_indices_
The indices of road surface.
static float CalAltitude(const float resolution, const int altitude_index)
Calculate altitude from altitude index.
static void Reduce(NdtMapCells *cell, const NdtMapCells &cell_new)
Combine two MapCell instances (Reduce).
size_t GetBinarySize() const
Get the binary size of the object.
size_t LoadBinary(const unsigned char *buf)
Load the map cell from a binary chunk.
std::unordered_map< int, NdtMapSingleCell > cells_
The multiple altitudes of the cell.
size_t CreateBinary(unsigned char *buf, size_t buf_size) const
Create the binary.
The data structure of ndt Map matrix.
NdtMapCells & GetMapCell(unsigned int row, unsigned int col)
Get a map cell.
virtual bool GetIntensityImg(cv::Mat *intensity_img) const
get intensity image of node.
static void Reduce(NdtMapMatrix *cells, const NdtMapMatrix &cells_new)
Combine two NdtMapMatrix instances (Reduce).
unsigned int GetRows() const
Get the size of row.
virtual size_t LoadBinary(const unsigned char *buf)
Load the map cell from a binary chunk.
unsigned int GetCols() const
Get the size of cols.
NdtMapMatrix()
The default constructor.
virtual void Reset()
Reset the matrix item to default value.
~NdtMapMatrix()
The default destructor.
virtual size_t GetBinarySize() const
Get the binary size of the object.
virtual size_t CreateBinary(unsigned char *buf, size_t buf_size) const
Create the binary.
virtual void Init(const BaseMapConfig &config)
Initialize the matrix with the config.
const NdtMapCells & GetMapCell(unsigned int row, unsigned int col) const
Get a const map cell.
The data structure of a single ndt map cell.
float intensity_
The average intensity value.
void MergeCell(const float intensity, const float intensity_var, const unsigned int road_pt_count, const unsigned int count, const Eigen::Vector3f ¢roid, const Eigen::Matrix3f ¢roid_cov)
Merge two cells.
unsigned int road_pt_count_
The number of samples belonging to road surface.
size_t LoadBinary(const unsigned char *buf)
Load the map cell from a binary chunk.
float intensity_var_
The variance intensity value.
Eigen::Vector3f centroid_
the centroid of the cell.
unsigned int count_
The number of samples in the cell.
NdtMapSingleCell & operator=(const NdtMapSingleCell &ref)
Overloading the assign operator.
void Reset()
Reset to default value.
void AddSample(const float intensity, const float altitude, const Eigen::Vector3f ¢roid, bool is_road=false)
Add an sample to the single 3d map cell.
void CentroidEigenSolver(const Eigen::Matrix3f ¢roid_cov)
static void Reduce(NdtMapSingleCell *cell, const NdtMapSingleCell &cell_new)
Combine two NdtMapSingleCell instances (Reduce).
Eigen::Matrix3f centroid_average_cov_
the pose covariance of the cell.
unsigned char is_icov_available_
the inverse covariance available flag.
Eigen::Matrix3f centroid_icov_
the pose inverse covariance of the cell.
const unsigned int minimum_points_threshold_
minimum number of points needed.
size_t CreateBinary(unsigned char *buf, size_t buf_size) const
Create the binary.
NdtMapSingleCell()
The default constructor.
size_t GetBinarySize() const
Get the binary size of the object.