Apollo 10.0
自动驾驶开放平台
apollo::localization::msf::NdtMapMatrix类 参考

The data structure of ndt Map matrix. 更多...

#include <ndt_map_matrix.h>

类 apollo::localization::msf::NdtMapMatrix 继承关系图:
apollo::localization::msf::NdtMapMatrix 的协作图:

Public 成员函数

 NdtMapMatrix ()
 The default constructor.
 
 ~NdtMapMatrix ()
 The default destructor.
 
 NdtMapMatrix (const NdtMapMatrix &cells)
 The copy constructor.
 
virtual void Init (const BaseMapConfig *config)
 Initialize the matrix with the config.
 
virtual void Reset (const BaseMapConfig *config)
 Reset the matrix item to default value.
 
void Init (unsigned int rows, unsigned int cols)
 Initialize the matrix with the size of rows and columns.
 
void Reset (unsigned int rows, unsigned int cols)
 Reset the matrix item to default value.
 
virtual unsigned int LoadBinary (unsigned char *buf)
 Load the map cell from a binary chunk.
 
virtual unsigned int CreateBinary (unsigned char *buf, unsigned int buf_size) const
 Create the binary.
 
virtual unsigned int GetBinarySize () const
 Get the binary size of the object.
 
virtual void GetIntensityImg (cv::Mat *intensity_img) const
 get intensity image of node.
 
const NdtMapCellsGetMapCell (unsigned int row, unsigned int col) const
 Get a const map cell.
 
NdtMapCellsGetMapCell (unsigned int row, unsigned int col)
 Get a map cell.
 
unsigned int GetRows () const
 Get the size of row.
 
unsigned int GetCols () const
 Get the size of cols.
 
- Public 成员函数 继承自 apollo::localization::msf::BaseMapMatrix
 BaseMapMatrix ()
 The default constructor.
 
virtual ~BaseMapMatrix ()
 The deconstructor.
 
 BaseMapMatrix (const BaseMapMatrix &cell)
 The copy constructor.
 

静态 Public 成员函数

static void Reduce (NdtMapMatrix *cells, const NdtMapMatrix &cells_new)
 Combine two NdtMapMatrix instances (Reduce).
 

详细描述

The data structure of ndt Map matrix.

在文件 ndt_map_matrix.h141 行定义.

构造及析构函数说明

◆ NdtMapMatrix() [1/2]

apollo::localization::msf::NdtMapMatrix::NdtMapMatrix ( )

The default constructor.

在文件 ndt_map_matrix.cc319 行定义.

319 {
320 rows_ = 0;
321 cols_ = 0;
322 map3d_cells_ = nullptr;
323}

◆ ~NdtMapMatrix()

apollo::localization::msf::NdtMapMatrix::~NdtMapMatrix ( )

The default destructor.

在文件 ndt_map_matrix.cc325 行定义.

325{}

◆ NdtMapMatrix() [2/2]

apollo::localization::msf::NdtMapMatrix::NdtMapMatrix ( const NdtMapMatrix cells)

The copy constructor.

在文件 ndt_map_matrix.cc327 行定义.

327 {
328 Init(cells.rows_, cells.cols_);
329 for (unsigned int y = 0; y < rows_; ++y) {
330 for (unsigned int x = 0; x < cols_; ++x) {
331 NdtMapCells& cell = GetMapCell(y, x);
332 const NdtMapCells& src_cell = cells.GetMapCell(y, x);
333 cell = NdtMapCells(src_cell);
334 }
335 }
336}
const NdtMapCells & GetMapCell(unsigned int row, unsigned int col) const
Get a const map cell.
virtual void Init(const BaseMapConfig *config)
Initialize the matrix with the config.
apollo::localization::msf::pyramid_map::NdtMapCells NdtMapCells

成员函数说明

◆ CreateBinary()

unsigned int apollo::localization::msf::NdtMapMatrix::CreateBinary ( unsigned char *  buf,
unsigned int  buf_size 
) const
virtual

Create the binary.

Serialization of the object.

参数
<buf,buf_size>The buffer and its size.
<return>The required or the used size of is returned.

实现了 apollo::localization::msf::BaseMapMatrix.

在文件 ndt_map_matrix.cc377 行定义.

378 {
379 unsigned int target_size = GetBinarySize();
380 if (buf_size >= target_size) {
381 unsigned int* p = reinterpret_cast<unsigned int*>(buf);
382 *p = rows_;
383 ++p;
384 *p = cols_;
385 ++p;
386 buf_size -= static_cast<unsigned int>(sizeof(unsigned int) * 2);
387 unsigned char* pp = reinterpret_cast<unsigned char*>(p);
388 for (unsigned int y = 0; y < rows_; ++y) {
389 for (unsigned int x = 0; x < cols_; ++x) {
390 const NdtMapCells& cell = GetMapCell(y, x);
391 unsigned int processed_size = cell.CreateBinary(pp, buf_size);
392 assert(buf_size >= processed_size);
393 buf_size -= processed_size;
394 pp += processed_size;
395 }
396 }
397 }
398 return target_size;
399}
virtual unsigned int GetBinarySize() const
Get the binary size of the object.

◆ GetBinarySize()

unsigned int apollo::localization::msf::NdtMapMatrix::GetBinarySize ( ) const
virtual

Get the binary size of the object.

实现了 apollo::localization::msf::BaseMapMatrix.

在文件 ndt_map_matrix.cc401 行定义.

401 {
402 unsigned int target_size =
403 static_cast<unsigned int>(sizeof(unsigned int) * 2);
404 for (unsigned int y = 0; y < rows_; ++y) {
405 for (unsigned int x = 0; x < cols_; ++x) {
406 const NdtMapCells& cell = GetMapCell(y, x);
407 target_size += cell.GetBinarySize();
408 }
409 }
410 return target_size;
411}

◆ GetCols()

unsigned int apollo::localization::msf::NdtMapMatrix::GetCols ( ) const
inline

Get the size of cols.

在文件 ndt_map_matrix.h190 行定义.

190{ return cols_; }

◆ GetIntensityImg()

void apollo::localization::msf::NdtMapMatrix::GetIntensityImg ( cv::Mat *  intensity_img) const
virtual

get intensity image of node.

实现了 apollo::localization::msf::BaseMapMatrix.

在文件 ndt_map_matrix.cc423 行定义.

423 {
424 *intensity_img = cv::Mat(cv::Size(cols_, rows_), CV_8UC1);
425 for (unsigned int y = 0; y < rows_; ++y) {
426 for (unsigned int x = 0; x < cols_; ++x) {
427 unsigned int id = y * cols_ + x;
428 int min_altitude_index = map3d_cells_[id].min_altitude_index_;
429 intensity_img->at<unsigned char>(y, x) =
430 (unsigned char)(map3d_cells_[id]
431 .cells_[min_altitude_index]
432 .intensity_);
433 }
434 }
435}

◆ GetMapCell() [1/2]

NdtMapCells & apollo::localization::msf::NdtMapMatrix::GetMapCell ( unsigned int  row,
unsigned int  col 
)
inline

Get a map cell.

在文件 ndt_map_matrix.h182 行定义.

182 {
183 assert(row < rows_);
184 assert(col < cols_);
185 return map3d_cells_[row * cols_ + col];
186 }

◆ GetMapCell() [2/2]

const NdtMapCells & apollo::localization::msf::NdtMapMatrix::GetMapCell ( unsigned int  row,
unsigned int  col 
) const
inline

Get a const map cell.

在文件 ndt_map_matrix.h175 行定义.

176 {
177 assert(row < rows_);
178 assert(col < cols_);
179 return map3d_cells_[row * cols_ + col];
180 }

◆ GetRows()

unsigned int apollo::localization::msf::NdtMapMatrix::GetRows ( ) const
inline

Get the size of row.

在文件 ndt_map_matrix.h188 行定义.

188{ return rows_; }

◆ Init() [1/2]

void apollo::localization::msf::NdtMapMatrix::Init ( const BaseMapConfig config)
virtual

Initialize the matrix with the config.

实现了 apollo::localization::msf::BaseMapMatrix.

在文件 ndt_map_matrix.cc338 行定义.

338 {
339 Init(config->map_node_size_y_, config->map_node_size_x_);
340}

◆ Init() [2/2]

void apollo::localization::msf::NdtMapMatrix::Init ( unsigned int  rows,
unsigned int  cols 
)

Initialize the matrix with the size of rows and columns.

在文件 ndt_map_matrix.cc346 行定义.

346 {
347 map3d_cells_.reset(new NdtMapCells[rows * cols]);
348 rows_ = rows;
349 cols_ = cols;
350}

◆ LoadBinary()

unsigned int apollo::localization::msf::NdtMapMatrix::LoadBinary ( unsigned char *  buf)
virtual

Load the map cell from a binary chunk.

参数
<return>The size read (the real size of object).

实现了 apollo::localization::msf::BaseMapMatrix.

在文件 ndt_map_matrix.cc359 行定义.

359 {
360 unsigned int* p = reinterpret_cast<unsigned int*>(buf);
361 rows_ = *p;
362 ++p;
363 cols_ = *p;
364 ++p;
365 Init(rows_, cols_);
366 unsigned char* pp = reinterpret_cast<unsigned char*>(p);
367 for (unsigned int y = 0; y < rows_; ++y) {
368 for (unsigned int x = 0; x < cols_; ++x) {
369 NdtMapCells& cell = GetMapCell(y, x);
370 unsigned int processed_size = cell.LoadBinary(pp);
371 pp += processed_size;
372 }
373 }
374 return GetBinarySize();
375}

◆ Reduce()

void apollo::localization::msf::NdtMapMatrix::Reduce ( NdtMapMatrix cells,
const NdtMapMatrix cells_new 
)
static

Combine two NdtMapMatrix instances (Reduce).

在文件 ndt_map_matrix.cc413 行定义.

413 {
414 for (unsigned int y = 0; y < cells->GetRows(); ++y) {
415 for (unsigned int x = 0; x < cells->GetCols(); ++x) {
416 NdtMapCells& cell = cells->GetMapCell(y, x);
417 const NdtMapCells& cell_new = cells_new.GetMapCell(y, x);
418 NdtMapCells::Reduce(&cell, cell_new);
419 }
420 }
421}
static void Reduce(NdtMapCells *cell, const NdtMapCells &cell_new)
Combine two MapCell instances (Reduce).

◆ Reset() [1/2]

void apollo::localization::msf::NdtMapMatrix::Reset ( const BaseMapConfig config)
virtual

Reset the matrix item to default value.

实现了 apollo::localization::msf::BaseMapMatrix.

在文件 ndt_map_matrix.cc342 行定义.

342 {
343 Reset(config->map_node_size_y_, config->map_node_size_x_);
344}
virtual void Reset(const BaseMapConfig *config)
Reset the matrix item to default value.

◆ Reset() [2/2]

void apollo::localization::msf::NdtMapMatrix::Reset ( unsigned int  rows,
unsigned int  cols 
)

Reset the matrix item to default value.

在文件 ndt_map_matrix.cc352 行定义.

352 {
353 unsigned int length = rows * cols;
354 for (unsigned int i = 0; i < length; ++i) {
355 map3d_cells_[i].Reset();
356 }
357}

该类的文档由以下文件生成: