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

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

#include <ndt_map_matrix.h>

类 apollo::localization::msf::pyramid_map::NdtMapMatrix 继承关系图:
apollo::localization::msf::pyramid_map::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 ()
 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 size_t LoadBinary (const unsigned char *buf)
 Load the map cell from a binary chunk.
 
virtual size_t CreateBinary (unsigned char *buf, size_t buf_size) const
 Create the binary.
 
virtual size_t GetBinarySize () const
 Get the binary size of the object.
 
virtual bool 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::pyramid_map::BaseMapMatrix
 BaseMapMatrix ()
 The default constructor.
 
virtual ~BaseMapMatrix ()
 The deconstructor.
 
 BaseMapMatrix (const BaseMapMatrix &map_matrix)
 The copy constructor.
 
virtual bool GetAltitudeImg (cv::Mat *altitude_img) const
 get altitude image of node.
 

静态 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::pyramid_map::NdtMapMatrix::NdtMapMatrix ( )

The default constructor.

在文件 ndt_map_matrix.cc412 行定义.

412 {
413 rows_ = 0;
414 cols_ = 0;
415 map3d_cells_ = nullptr;
416}

◆ ~NdtMapMatrix()

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

The default destructor.

在文件 ndt_map_matrix.cc418 行定义.

418{}

◆ NdtMapMatrix() [2/2]

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

The copy constructor.

在文件 ndt_map_matrix.cc420 行定义.

420 {
421 Init(cells.rows_, cells.cols_);
422 for (unsigned int y = 0; y < rows_; ++y) {
423 for (unsigned int x = 0; x < cols_; ++x) {
424 NdtMapCells& cell = GetMapCell(y, x);
425 const NdtMapCells& src_cell = cells.GetMapCell(y, x);
426 cell = NdtMapCells(src_cell);
427 }
428 }
429}
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.
apollo::localization::msf::pyramid_map::NdtMapCells NdtMapCells

成员函数说明

◆ CreateBinary()

size_t apollo::localization::msf::pyramid_map::NdtMapMatrix::CreateBinary ( unsigned char *  buf,
size_t  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.

在文件 ndt_map_matrix.cc468 行定义.

468 {
469 size_t target_size = GetBinarySize();
470 if (buf_size >= target_size) {
471 unsigned int* p = reinterpret_cast<unsigned int*>(buf);
472 *p = rows_;
473 ++p;
474 *p = cols_;
475 ++p;
476 buf_size -= static_cast<unsigned int>(sizeof(unsigned int) * 2);
477 unsigned char* pp = reinterpret_cast<unsigned char*>(p);
478 for (unsigned int y = 0; y < rows_; ++y) {
479 for (unsigned int x = 0; x < cols_; ++x) {
480 const NdtMapCells& cell = GetMapCell(y, x);
481 size_t processed_size = cell.CreateBinary(pp, buf_size);
482 assert(buf_size >= processed_size);
483 buf_size -= processed_size;
484 pp += processed_size;
485 }
486 }
487 }
488 return target_size;
489}
virtual size_t GetBinarySize() const
Get the binary size of the object.

◆ GetBinarySize()

size_t apollo::localization::msf::pyramid_map::NdtMapMatrix::GetBinarySize ( ) const
virtual

Get the binary size of the object.

在文件 ndt_map_matrix.cc491 行定义.

491 {
492 size_t target_size = sizeof(unsigned int) * 2;
493 for (unsigned int y = 0; y < rows_; ++y) {
494 for (unsigned int x = 0; x < cols_; ++x) {
495 const NdtMapCells& cell = GetMapCell(y, x);
496 target_size += cell.GetBinarySize();
497 }
498 }
499 return target_size;
500}

◆ GetCols()

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

Get the size of cols.

在文件 ndt_map_matrix.h189 行定义.

189{ return cols_; }

◆ GetIntensityImg()

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

get intensity image of node.

重载 apollo::localization::msf::pyramid_map::BaseMapMatrix .

在文件 ndt_map_matrix.cc512 行定义.

512 {
513 *intensity_img = cv::Mat(cv::Size(cols_, rows_), CV_8UC1);
514 for (unsigned int y = 0; y < rows_; ++y) {
515 for (unsigned int x = 0; x < cols_; ++x) {
516 unsigned int id = y * cols_ + x;
517 int min_altitude_index = map3d_cells_[id].min_altitude_index_;
518 intensity_img->at<unsigned char>(y, x) =
519 (unsigned char)(map3d_cells_[id]
520 .cells_[min_altitude_index]
521 .intensity_);
522 }
523 }
524 return true;
525}

◆ GetMapCell() [1/2]

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

Get a map cell.

在文件 ndt_map_matrix.h181 行定义.

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

◆ GetMapCell() [2/2]

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

Get a const map cell.

在文件 ndt_map_matrix.h174 行定义.

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

◆ GetRows()

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

Get the size of row.

在文件 ndt_map_matrix.h187 行定义.

187{ return rows_; }

◆ Init() [1/2]

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

Initialize the matrix with the config.

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

在文件 ndt_map_matrix.cc431 行定义.

431 {
432 Init(config.map_node_size_y_, config.map_node_size_x_);
433}

◆ Init() [2/2]

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

Initialize the matrix with the size of rows and columns.

在文件 ndt_map_matrix.cc437 行定义.

437 {
438 map3d_cells_.reset(new NdtMapCells[rows * cols]);
439 rows_ = rows;
440 cols_ = cols;
441}

◆ LoadBinary()

size_t apollo::localization::msf::pyramid_map::NdtMapMatrix::LoadBinary ( const unsigned char *  buf)
virtual

Load the map cell from a binary chunk.

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

在文件 ndt_map_matrix.cc450 行定义.

450 {
451 const unsigned int* p = reinterpret_cast<const unsigned int*>(buf);
452 rows_ = *p;
453 ++p;
454 cols_ = *p;
455 ++p;
456 Init(rows_, cols_);
457 const unsigned char* pp = reinterpret_cast<const unsigned char*>(p);
458 for (unsigned int y = 0; y < rows_; ++y) {
459 for (unsigned int x = 0; x < cols_; ++x) {
460 NdtMapCells& cell = GetMapCell(y, x);
461 size_t processed_size = cell.LoadBinary(pp);
462 pp += processed_size;
463 }
464 }
465 return GetBinarySize();
466}

◆ Reduce()

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

Combine two NdtMapMatrix instances (Reduce).

在文件 ndt_map_matrix.cc502 行定义.

502 {
503 for (unsigned int y = 0; y < cells->GetRows(); ++y) {
504 for (unsigned int x = 0; x < cells->GetCols(); ++x) {
505 NdtMapCells& cell = cells->GetMapCell(y, x);
506 const NdtMapCells& cell_new = cells_new.GetMapCell(y, x);
507 NdtMapCells::Reduce(&cell, cell_new);
508 }
509 }
510}
static void Reduce(NdtMapCells *cell, const NdtMapCells &cell_new)
Combine two MapCell instances (Reduce).

◆ Reset() [1/2]

void apollo::localization::msf::pyramid_map::NdtMapMatrix::Reset ( )
virtual

Reset the matrix item to default value.

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

在文件 ndt_map_matrix.cc435 行定义.

435{ Reset(rows_, cols_); }
virtual void Reset()
Reset the matrix item to default value.

◆ Reset() [2/2]

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

Reset the matrix item to default value.

在文件 ndt_map_matrix.cc443 行定义.

443 {
444 unsigned int length = rows * cols;
445 for (unsigned int i = 0; i < length; ++i) {
446 map3d_cells_[i].Reset();
447 }
448}

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