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

#include <pyramid_map_node.h>

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

Public 成员函数

 PyramidMapNode ()
 
 ~PyramidMapNode ()
 
virtual void Init (const BaseMapConfig *map_config)
 Initialize the map node.
 
virtual void Init (const BaseMapConfig *map_config, const MapNodeIndex &index, bool create_map_cells=true)
 
void BottomUpSafe ()
 Propagate the data to the coarse resolution by check.
 
void BottomUpBase ()
 Propagate the data to the coarse resolution.
 
bool AddValueIfInBound (const Eigen::Vector3d &coordinate, unsigned char intensity, unsigned int level=0)
 Add the value of a pixel in the map node if the pixel in the node.
 
void AddValueIfInBound (const std::vector< Eigen::Vector3d > &coordinates, const std::vector< unsigned char > &intensity, unsigned int level=0)
 Add the value of a pixel in the map node if the pixel in the node.
 
bool GetCoordinate (const Eigen::Vector2d &coordinate, unsigned int level, unsigned int *x, unsigned int *y) const
 Given the global coordinate, get the local 2D coordinate of the map cell matrix.
 
Eigen::Vector2d GetCoordinate (unsigned int level, unsigned int x, unsigned int y) const
 Given the local 2D coordinate, return the global coordinate.
 
virtual bool GetCoordinate (const Eigen::Vector2d &coordinate, unsigned int *x, unsigned int *y) const
 Given the global coordinate, get the local 2D coordinate of the map cell matrix.
 
virtual bool GetCoordinate (const Eigen::Vector3d &coordinate, unsigned int *x, unsigned int *y) const
 
virtual Eigen::Vector2d GetCoordinate (unsigned int x, unsigned int y) const
 Given the local 2D coordinate, return the global coordinate.
 
float GetIntensitySafe (const Eigen::Vector3d &coordinate, unsigned int level=0) const
 Given the 3D global coordinate, get the map cell intensity with check.
 
float GetIntensityVarSafe (const Eigen::Vector3d &coordinate, unsigned int level=0) const
 Given the 3D global coordinate, get the map cell variance of the intensity with check.
 
float GetAltitudeSafe (const Eigen::Vector3d &coordinate, unsigned int level=0) const
 Given the 3D global coordinate, get the map cell's average altitude with check.
 
float GetAltitudeVarSafe (const Eigen::Vector3d &coordinate, unsigned int level=0) const
 Given the 3D global coordinate, get the map cell's variance of the altitude with check.
 
float GetGroundAltitudeSafe (const Eigen::Vector3d &coordinate, unsigned int level=0) const
 Given the 3D global coordinate, get the map cell's average ground altitude with check.
 
unsigned int GetCountSafe (const Eigen::Vector3d &coordinate, unsigned int level=0) const
 Given the 3D global coordinate, get the map cell's count of the samples with check.
 
unsigned int GetGroundCountSafe (const Eigen::Vector3d &coordinate, unsigned int level=0) const
 Given the 3D global coordinate, get the map cell's count of the ground samples with check.
 
float GetIntensity (const Eigen::Vector3d &coordinate, unsigned int level=0) const
 Given the 3D global coordinate, get the map cell intensity without check.
 
float GetIntensityVar (const Eigen::Vector3d &coordinate, unsigned int level=0) const
 Given the 3D global coordinate, get the map cell variance of the intensity without check.
 
float GetAltitude (const Eigen::Vector3d &coordinate, unsigned int level=0) const
 Given the 3D global coordinate, get the map cell's average altitude without check.
 
float GetAltitudeVar (const Eigen::Vector3d &coordinate, unsigned int level=0) const
 Given the 3D global coordinate, get the map cell's variance of the altitude without check.
 
float GetGroundAltitude (const Eigen::Vector3d &coordinate, unsigned int level=0) const
 Given the 3D global coordinate, get the map cell's average ground altitude without check.
 
unsigned int GetCount (const Eigen::Vector3d &coordinate, unsigned int level=0) const
 Given the 3D global coordinate, get the map cell's count of the samples without check.
 
unsigned int GetGroundCount (const Eigen::Vector3d &coordinate, unsigned int level=0) const
 Given the 3D global coordinate, get the map cell's count of the ground samples without check.
 
double ComputeMeanIntensity (unsigned int level=0)
 Compute mean intensity.
 
- Public 成员函数 继承自 apollo::localization::msf::pyramid_map::BaseMapNode
 BaseMapNode ()
 Construct a map node.
 
 BaseMapNode (BaseMapMatrix *matrix, CompressionStrategy *strategy)
 Construct a map node.
 
virtual ~BaseMapNode ()
 Destruct a map node.
 
virtual void InitMapMatrix (const BaseMapConfig *map_config)
 Initialize the map matrix.
 
virtual void Finalize ()
 call before deconstruction or reset.
 
virtual void ResetMapNode ()
 Reset map cells data.
 
bool Save ()
 Save the map node to the disk.
 
bool SaveIntensityImage () const
 Save intensity image of node.
 
bool SaveAltitudeImage () const
 Save altitude image of node.
 
bool Load ()
 Load the map node from the disk.
 
bool Load (const char *filename)
 
void SetMapNodeIndex (const MapNodeIndex &index)
 Set the map node index.
 
bool SaveIntensityImage (const std::string &path) const
 Save intensity image of node.
 
bool SaveAltitudeImage (const std::string &path) const
 Save altitude image of node.
 
const BaseMapMatrixGetMapCellMatrix () const
 Get map cell matrix.
 
BaseMapMatrixGetMapCellMatrix ()
 
const BaseMapConfigGetMapConfig () const
 Get the map settings.
 
const BaseMapNodeConfigGetMapNodeConfig () const
 Get the map node config.
 
const MapNodeIndexGetMapNodeIndex () const
 Get the map node index.
 
void SetIsReserved (bool is_reserved)
 Set if the map node is reserved.
 
bool GetIsReserved () const
 Get if the map node is reserved.
 
bool GetIsChanged () const
 Get if the map data has changed.
 
void SetIsChanged (bool is)
 Set if the map node data has changed.
 
bool GetIsReady () const
 Get if the map node data is ready
 
const Eigen::Vector2d & GetLeftTopCorner () const
 
void SetLeftTopCorner (double x, double y)
 Set the left top corner of the map node.
 
float GetMapResolution () const
 Get the resolution of this map nodex.
 

额外继承的成员函数

- 静态 Public 成员函数 继承自 apollo::localization::msf::pyramid_map::BaseMapNode
static Eigen::Vector2d ComputeLeftTopCorner (const BaseMapConfig &config, const MapNodeIndex &index)
 
static Eigen::Vector2d GetLeftTopCorner (const BaseMapConfig &option, const MapNodeIndex &index)
 
- Protected 成员函数 继承自 apollo::localization::msf::pyramid_map::BaseMapNode
bool CreateMapDirectory (const std::string &path) const
 Try to create the map directory.
 
bool CreateMapDirectoryRecursively (const std::vector< std::string > &paths) const
 Try to create the map directory recursively.
 
bool CheckMapDirectoryRecursively (const std::vector< std::string > &paths) const
 Try to check the map directory recursively.
 
virtual bool LoadBinary (FILE *file)
 Load the map cell from a binary chunk.
 
virtual bool CreateBinary (FILE *file) const
 Create the binary.
 
virtual size_t GetBinarySize () const
 Get the binary size of the object.
 
virtual size_t LoadHeaderBinary (const unsigned char *buf)
 Load the map node header from a binary chunk.
 
virtual size_t CreateHeaderBinary (unsigned char *buf, size_t buf_size) const
 Create the binary header.
 
virtual size_t GetHeaderBinarySize () const
 Get the size of the header in bytes.
 
virtual size_t LoadBodyBinary (std::vector< unsigned char > *buf)
 Load the map node body from a binary chunk.
 
virtual size_t CreateBodyBinary (std::vector< unsigned char > *buf) const
 Create the binary body.
 
virtual size_t GetBodyBinarySize () const
 Get the size of the body in bytes.
 
- Protected 属性 继承自 apollo::localization::msf::pyramid_map::BaseMapNode
const BaseMapConfigmap_config_ = nullptr
 The map settings.
 
MapNodeIndex index_
 The index of this node
 
Eigen::Vector2d left_top_corner_
 The left top corner of the map node in the global coordinate system.
 
std::shared_ptr< BaseMapNodeConfigmap_node_config_ = nullptr
 The map node config.
 
std::shared_ptr< BaseMapMatrixmap_matrix_ = nullptr
 The data structure of the map datas, which is a matrix.
 
std::shared_ptr< BaseMapMatrixHandlermap_matrix_handler_ = nullptr
 The class to load and create map matrix binary.
 
bool is_reserved_ = false
 If the node is reserved in map.
 
bool is_changed_ = false
 Has the map node been changed.
 
bool data_is_ready_ = false
 
size_t file_body_binary_size_ = 0
 The body binary size in file.
 
size_t uncompressed_file_body_size_ = 0
 
std::shared_ptr< CompressionStrategycompression_strategy_ = nullptr
 @bried The compression strategy.
 

详细描述

在文件 pyramid_map_node.h30 行定义.

构造及析构函数说明

◆ PyramidMapNode()

apollo::localization::msf::pyramid_map::PyramidMapNode::PyramidMapNode ( )

在文件 pyramid_map_node.cc29 行定义.

29{}

◆ ~PyramidMapNode()

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

在文件 pyramid_map_node.cc31 行定义.

31{}

成员函数说明

◆ AddValueIfInBound() [1/2]

bool apollo::localization::msf::pyramid_map::PyramidMapNode::AddValueIfInBound ( const Eigen::Vector3d &  coordinate,
unsigned char  intensity,
unsigned int  level = 0 
)

Add the value of a pixel in the map node if the pixel in the node.

参数
<coordinate>The 3D global coordinate.
<intensity>The reflectance intensity.
<return>True, if pixel in the bound of the node, else False.

在文件 pyramid_map_node.cc114 行定义.

116 {
117 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
118 // Eigen::Map<Eigen::Vector2d>(coordinate.data(), 2);
119 unsigned int x = 0;
120 unsigned int y = 0;
121 bool is_success = GetCoordinate(coord2d, level, &x, &y);
122 if (is_success) {
123 std::shared_ptr<PyramidMapMatrix> map_matrix =
124 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
125 map_matrix->AddSampleBase(static_cast<float>(intensity),
126 static_cast<float>(coordinate[2]), y, x, level);
127 return true;
128 } else {
129 return false;
130 }
131}
std::shared_ptr< BaseMapMatrix > map_matrix_
The data structure of the map datas, which is a matrix.
bool GetCoordinate(const Eigen::Vector2d &coordinate, unsigned int level, unsigned int *x, unsigned int *y) const
Given the global coordinate, get the local 2D coordinate of the map cell matrix.

◆ AddValueIfInBound() [2/2]

void apollo::localization::msf::pyramid_map::PyramidMapNode::AddValueIfInBound ( const std::vector< Eigen::Vector3d > &  coordinates,
const std::vector< unsigned char > &  intensity,
unsigned int  level = 0 
)

Add the value of a pixel in the map node if the pixel in the node.

参数
<coordinates>The 3D global coordinates.
<intensities>The reflectance intensities.

在文件 pyramid_map_node.cc133 行定义.

135 {
136 if (coordinates.size() != intensity.size()) {
137 return;
138 }
139
140 for (unsigned int i = 0; i < coordinates.size(); i++) {
141 AddValueIfInBound(coordinates[i], intensity[i], level);
142 }
143}
bool AddValueIfInBound(const Eigen::Vector3d &coordinate, unsigned char intensity, unsigned int level=0)
Add the value of a pixel in the map node if the pixel in the node.

◆ BottomUpBase()

void apollo::localization::msf::pyramid_map::PyramidMapNode::BottomUpBase ( )

Propagate the data to the coarse resolution.

only update count, intensity, intensity var and altitude

在文件 pyramid_map_node.cc102 行定义.

102 {
103 std::shared_ptr<PyramidMapMatrix> map_matrix =
104 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
105 map_matrix->BottomUpBase();
106}

◆ BottomUpSafe()

void apollo::localization::msf::pyramid_map::PyramidMapNode::BottomUpSafe ( )

Propagate the data to the coarse resolution by check.

在文件 pyramid_map_node.cc108 行定义.

108 {
109 std::shared_ptr<PyramidMapMatrix> map_matrix =
110 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
111 map_matrix->BottomUpSafe();
112}

◆ ComputeMeanIntensity()

double apollo::localization::msf::pyramid_map::PyramidMapNode::ComputeMeanIntensity ( unsigned int  level = 0)

Compute mean intensity.

在文件 pyramid_map_node.cc495 行定义.

495 {
496 std::shared_ptr<PyramidMapMatrix> map_matrix =
497 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
498 return map_matrix->ComputeMeanIntensity(level);
499}

◆ GetAltitude()

float apollo::localization::msf::pyramid_map::PyramidMapNode::GetAltitude ( const Eigen::Vector3d &  coordinate,
unsigned int  level = 0 
) const

Given the 3D global coordinate, get the map cell's average altitude without check.

在文件 pyramid_map_node.cc388 行定义.

389 {
390 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
391 unsigned int x = 0;
392 unsigned int y = 0;
393 bool is_success = GetCoordinate(coord2d, level, &x, &y);
394
395 float altitude = 0.0;
396 if (is_success) {
397 std::shared_ptr<PyramidMapMatrix> map_matrix =
398 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
399 const float* altitude_ptr = map_matrix->GetAltitude(y, x, level);
400
401 if (altitude_ptr != nullptr) {
402 altitude = *altitude_ptr;
403 }
404 }
405
406 return altitude;
407}

◆ GetAltitudeSafe()

float apollo::localization::msf::pyramid_map::PyramidMapNode::GetAltitudeSafe ( const Eigen::Vector3d &  coordinate,
unsigned int  level = 0 
) const

Given the 3D global coordinate, get the map cell's average altitude with check.

在文件 pyramid_map_node.cc239 行定义.

240 {
241 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
242 unsigned int x = 0;
243 unsigned int y = 0;
244 bool is_success = GetCoordinate(coord2d, level, &x, &y);
245
246 float altitude = 0.0;
247 if (is_success) {
248 std::shared_ptr<PyramidMapMatrix> map_matrix =
249 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
250 const float* altitude_ptr = map_matrix->GetAltitudeSafe(y, x, level);
251
252 if (altitude_ptr != nullptr) {
253 altitude = *altitude_ptr;
254 }
255 }
256
257 return altitude;
258}

◆ GetAltitudeVar()

float apollo::localization::msf::pyramid_map::PyramidMapNode::GetAltitudeVar ( const Eigen::Vector3d &  coordinate,
unsigned int  level = 0 
) const

Given the 3D global coordinate, get the map cell's variance of the altitude without check.

在文件 pyramid_map_node.cc409 行定义.

410 {
411 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
412 unsigned int x = 0;
413 unsigned int y = 0;
414 bool is_success = GetCoordinate(coord2d, level, &x, &y);
415
416 float altitude_var = 0.0;
417 if (is_success) {
418 std::shared_ptr<PyramidMapMatrix> map_matrix =
419 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
420 const float* altitude_var_ptr = map_matrix->GetAltitudeVar(y, x, level);
421
422 if (altitude_var_ptr != nullptr) {
423 altitude_var = *altitude_var_ptr;
424 }
425 }
426
427 return altitude_var;
428}

◆ GetAltitudeVarSafe()

float apollo::localization::msf::pyramid_map::PyramidMapNode::GetAltitudeVarSafe ( const Eigen::Vector3d &  coordinate,
unsigned int  level = 0 
) const

Given the 3D global coordinate, get the map cell's variance of the altitude with check.

在文件 pyramid_map_node.cc260 行定义.

261 {
262 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
263 unsigned int x = 0;
264 unsigned int y = 0;
265 bool is_success = GetCoordinate(coord2d, level, &x, &y);
266
267 float altitude_var = 0.0;
268 if (is_success) {
269 std::shared_ptr<PyramidMapMatrix> map_matrix =
270 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
271 const float* altitude_var_ptr = map_matrix->GetAltitudeVarSafe(y, x, level);
272
273 if (altitude_var_ptr != nullptr) {
274 altitude_var = *altitude_var_ptr;
275 }
276 }
277
278 return altitude_var;
279}

◆ GetCoordinate() [1/5]

bool apollo::localization::msf::pyramid_map::PyramidMapNode::GetCoordinate ( const Eigen::Vector2d &  coordinate,
unsigned int *  x,
unsigned int *  y 
) const
virtual

Given the global coordinate, get the local 2D coordinate of the map cell matrix.

<return> If global coordinate (x, y) belongs to this map node.

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

在文件 pyramid_map_node.cc182 行定义.

183 {
184 return BaseMapNode::GetCoordinate(coordinate, x, y);
185}
virtual bool GetCoordinate(const Eigen::Vector2d &coordinate, unsigned int *x, unsigned int *y) const
Given the global coordinate, get the local 2D coordinate of the map cell matrix.

◆ GetCoordinate() [2/5]

bool apollo::localization::msf::pyramid_map::PyramidMapNode::GetCoordinate ( const Eigen::Vector2d &  coordinate,
unsigned int  level,
unsigned int *  x,
unsigned int *  y 
) const

Given the global coordinate, get the local 2D coordinate of the map cell matrix.

<return> If global coordinate (x, y) belongs to this map node.

在文件 pyramid_map_node.cc145 行定义.

147 {
148 std::shared_ptr<PyramidMapMatrix> map_matrix =
149 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
150
151 const float& current_resolution = resolutions_mr_[level];
152
153 unsigned int off_x = static_cast<unsigned int>(
154 (coordinate[0] - left_top_corner_[0]) / current_resolution);
155 unsigned int off_y = static_cast<unsigned int>(
156 (coordinate[1] - left_top_corner_[1]) / current_resolution);
157 if (off_x < map_matrix->GetCols(level) &&
158 off_y < map_matrix->GetRows(level)) {
159 *x = off_x;
160 *y = off_y;
161 return true;
162 }
163 return false;
164}
Eigen::Vector2d left_top_corner_
The left top corner of the map node in the global coordinate system.

◆ GetCoordinate() [3/5]

bool apollo::localization::msf::pyramid_map::PyramidMapNode::GetCoordinate ( const Eigen::Vector3d &  coordinate,
unsigned int *  x,
unsigned int *  y 
) const
virtual

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

在文件 pyramid_map_node.cc186 行定义.

187 {
188 return BaseMapNode::GetCoordinate(coordinate, x, y);
189}

◆ GetCoordinate() [4/5]

Eigen::Vector2d apollo::localization::msf::pyramid_map::PyramidMapNode::GetCoordinate ( unsigned int  level,
unsigned int  x,
unsigned int  y 
) const

Given the local 2D coordinate, return the global coordinate.

在文件 pyramid_map_node.cc166 行定义.

168 {
169 const PyramidMapConfig* map_config =
170 dynamic_cast<const PyramidMapConfig*>(map_config_);
171
172 float current_resolution =
173 static_cast<float>(map_config->map_resolutions_[0] *
174 std::pow(map_config->resolution_ratio_, level));
175
176 Eigen::Vector2d coord;
177 coord[0] = left_top_corner_[0] + current_resolution * static_cast<float>(x);
178 coord[1] = left_top_corner_[1] + current_resolution * static_cast<float>(y);
179 return coord;
180}
const BaseMapConfig * map_config_
The map settings.

◆ GetCoordinate() [5/5]

Eigen::Vector2d apollo::localization::msf::pyramid_map::PyramidMapNode::GetCoordinate ( unsigned int  x,
unsigned int  y 
) const
virtual

Given the local 2D coordinate, return the global coordinate.

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

在文件 pyramid_map_node.cc191 行定义.

192 {
193 return BaseMapNode::GetCoordinate(x, y);
194}

◆ GetCount()

unsigned int apollo::localization::msf::pyramid_map::PyramidMapNode::GetCount ( const Eigen::Vector3d &  coordinate,
unsigned int  level = 0 
) const

Given the 3D global coordinate, get the map cell's count of the samples without check.

在文件 pyramid_map_node.cc452 行定义.

453 {
454 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
455 unsigned int x = 0;
456 unsigned int y = 0;
457 bool is_success = GetCoordinate(coord2d, level, &x, &y);
458
459 unsigned int count = 0;
460 if (is_success) {
461 std::shared_ptr<PyramidMapMatrix> map_matrix =
462 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
463 const unsigned int* count_ptr = map_matrix->GetCount(y, x, level);
464
465 if (count_ptr != nullptr) {
466 count = *count_ptr;
467 }
468 }
469
470 return count;
471}

◆ GetCountSafe()

unsigned int apollo::localization::msf::pyramid_map::PyramidMapNode::GetCountSafe ( const Eigen::Vector3d &  coordinate,
unsigned int  level = 0 
) const

Given the 3D global coordinate, get the map cell's count of the samples with check.

在文件 pyramid_map_node.cc303 行定义.

304 {
305 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
306 unsigned int x = 0;
307 unsigned int y = 0;
308 bool is_success = GetCoordinate(coord2d, level, &x, &y);
309
310 unsigned int count = 0;
311 if (is_success) {
312 std::shared_ptr<PyramidMapMatrix> map_matrix =
313 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
314 const unsigned int* count_ptr = map_matrix->GetCountSafe(y, x, level);
315
316 if (count_ptr != nullptr) {
317 count = *count_ptr;
318 }
319 }
320
321 return count;
322}

◆ GetGroundAltitude()

float apollo::localization::msf::pyramid_map::PyramidMapNode::GetGroundAltitude ( const Eigen::Vector3d &  coordinate,
unsigned int  level = 0 
) const

Given the 3D global coordinate, get the map cell's average ground altitude without check.

在文件 pyramid_map_node.cc430 行定义.

431 {
432 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
433 unsigned int x = 0;
434 unsigned int y = 0;
435 bool is_success = GetCoordinate(coord2d, level, &x, &y);
436
437 float ground_altitude = 0.0;
438 if (is_success) {
439 std::shared_ptr<PyramidMapMatrix> map_matrix =
440 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
441 const float* ground_altitude_ptr =
442 map_matrix->GetGroundAltitude(y, x, level);
443
444 if (ground_altitude_ptr != nullptr) {
445 ground_altitude = *ground_altitude_ptr;
446 }
447 }
448
449 return ground_altitude;
450}

◆ GetGroundAltitudeSafe()

float apollo::localization::msf::pyramid_map::PyramidMapNode::GetGroundAltitudeSafe ( const Eigen::Vector3d &  coordinate,
unsigned int  level = 0 
) const

Given the 3D global coordinate, get the map cell's average ground altitude with check.

在文件 pyramid_map_node.cc281 行定义.

282 {
283 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
284 unsigned int x = 0;
285 unsigned int y = 0;
286 bool is_success = GetCoordinate(coord2d, level, &x, &y);
287
288 float ground_altitude = 0.0;
289 if (is_success) {
290 std::shared_ptr<PyramidMapMatrix> map_matrix =
291 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
292 const float* ground_altitude_ptr =
293 map_matrix->GetGroundAltitudeSafe(y, x, level);
294
295 if (ground_altitude_ptr != nullptr) {
296 ground_altitude = *ground_altitude_ptr;
297 }
298 }
299
300 return ground_altitude;
301}

◆ GetGroundCount()

unsigned int apollo::localization::msf::pyramid_map::PyramidMapNode::GetGroundCount ( const Eigen::Vector3d &  coordinate,
unsigned int  level = 0 
) const

Given the 3D global coordinate, get the map cell's count of the ground samples without check.

在文件 pyramid_map_node.cc473 行定义.

474 {
475 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
476 unsigned int x = 0;
477 unsigned int y = 0;
478 bool is_success = GetCoordinate(coord2d, level, &x, &y);
479
480 unsigned int ground_count = 0;
481 if (is_success) {
482 std::shared_ptr<PyramidMapMatrix> map_matrix =
483 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
484 const unsigned int* ground_count_ptr =
485 map_matrix->GetGroundCount(y, x, level);
486
487 if (ground_count_ptr != nullptr) {
488 ground_count = *ground_count_ptr;
489 }
490 }
491
492 return ground_count;
493}

◆ GetGroundCountSafe()

unsigned int apollo::localization::msf::pyramid_map::PyramidMapNode::GetGroundCountSafe ( const Eigen::Vector3d &  coordinate,
unsigned int  level = 0 
) const

Given the 3D global coordinate, get the map cell's count of the ground samples with check.

在文件 pyramid_map_node.cc324 行定义.

325 {
326 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
327 unsigned int x = 0;
328 unsigned int y = 0;
329 bool is_success = GetCoordinate(coord2d, level, &x, &y);
330
331 unsigned int ground_count = 0;
332 if (is_success) {
333 std::shared_ptr<PyramidMapMatrix> map_matrix =
334 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
335 const unsigned int* ground_count_ptr =
336 map_matrix->GetGroundCountSafe(y, x, level);
337
338 if (ground_count_ptr != nullptr) {
339 ground_count = *ground_count_ptr;
340 }
341 }
342
343 return ground_count;
344}

◆ GetIntensity()

float apollo::localization::msf::pyramid_map::PyramidMapNode::GetIntensity ( const Eigen::Vector3d &  coordinate,
unsigned int  level = 0 
) const

Given the 3D global coordinate, get the map cell intensity without check.

在文件 pyramid_map_node.cc346 行定义.

347 {
348 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
349 unsigned int x = 0;
350 unsigned int y = 0;
351 bool is_success = GetCoordinate(coord2d, level, &x, &y);
352
353 float intensity = 0.0;
354 if (is_success) {
355 std::shared_ptr<PyramidMapMatrix> map_matrix =
356 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
357 const float* intensity_ptr = map_matrix->GetIntensity(y, x, level);
358
359 if (intensity_ptr != nullptr) {
360 intensity = *intensity_ptr;
361 }
362 }
363
364 return intensity;
365}

◆ GetIntensitySafe()

float apollo::localization::msf::pyramid_map::PyramidMapNode::GetIntensitySafe ( const Eigen::Vector3d &  coordinate,
unsigned int  level = 0 
) const

Given the 3D global coordinate, get the map cell intensity with check.

在文件 pyramid_map_node.cc196 行定义.

197 {
198 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
199 unsigned int x = 0;
200 unsigned int y = 0;
201 bool is_success = GetCoordinate(coord2d, level, &x, &y);
202
203 float intensity = 0.0;
204 if (is_success) {
205 std::shared_ptr<PyramidMapMatrix> map_matrix =
206 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
207 const float* intensity_ptr = map_matrix->GetIntensitySafe(y, x, level);
208
209 if (intensity_ptr != nullptr) {
210 intensity = *intensity_ptr;
211 }
212 }
213
214 return intensity;
215}

◆ GetIntensityVar()

float apollo::localization::msf::pyramid_map::PyramidMapNode::GetIntensityVar ( const Eigen::Vector3d &  coordinate,
unsigned int  level = 0 
) const

Given the 3D global coordinate, get the map cell variance of the intensity without check.

在文件 pyramid_map_node.cc367 行定义.

368 {
369 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
370 unsigned int x = 0;
371 unsigned int y = 0;
372 bool is_success = GetCoordinate(coord2d, level, &x, &y);
373
374 float intensity_var = 0.0;
375 if (is_success) {
376 std::shared_ptr<PyramidMapMatrix> map_matrix =
377 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
378 const float* intensity_var_ptr = map_matrix->GetIntensityVar(y, x, level);
379
380 if (intensity_var_ptr != nullptr) {
381 intensity_var = *intensity_var_ptr;
382 }
383 }
384
385 return intensity_var;
386}

◆ GetIntensityVarSafe()

float apollo::localization::msf::pyramid_map::PyramidMapNode::GetIntensityVarSafe ( const Eigen::Vector3d &  coordinate,
unsigned int  level = 0 
) const

Given the 3D global coordinate, get the map cell variance of the intensity with check.

在文件 pyramid_map_node.cc217 行定义.

218 {
219 Eigen::Vector2d coord2d(coordinate[0], coordinate[1]);
220 unsigned int x = 0;
221 unsigned int y = 0;
222 bool is_success = GetCoordinate(coord2d, level, &x, &y);
223
224 float intensity_var = 0.0;
225 if (is_success) {
226 std::shared_ptr<PyramidMapMatrix> map_matrix =
227 std::dynamic_pointer_cast<PyramidMapMatrix>(map_matrix_);
228 const float* intensity_var_ptr =
229 map_matrix->GetIntensityVarSafe(y, x, level);
230
231 if (intensity_var_ptr != nullptr) {
232 intensity_var = *intensity_var_ptr;
233 }
234 }
235
236 return intensity_var;
237}

◆ Init() [1/2]

void apollo::localization::msf::pyramid_map::PyramidMapNode::Init ( const BaseMapConfig map_config)
virtual

Initialize the map node.

Call this function first before use it!

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

在文件 pyramid_map_node.cc33 行定义.

33 {
34 map_config_ = map_config;
35
36 map_node_config_.reset(new PyramidMapNodeConfig());
40 map_node_config_->has_map_version_ = false;
41 map_node_config_->has_body_md5_ = false;
42 } else {
43 map_node_config_->has_map_version_ = true;
44 map_node_config_->has_body_md5_ = true;
45 }
46
47 is_reserved_ = false;
48 data_is_ready_ = false;
49 is_changed_ = false;
50
51 map_matrix_.reset(new PyramidMapMatrix());
54 map_node_config_->map_version_));
55 compression_strategy_.reset(new ZlibStrategy());
56
57 const PyramidMapConfig* pm_map_config =
58 dynamic_cast<const PyramidMapConfig*>(map_config_);
59 resolutions_mr_.resize(pm_map_config->resolution_num_, 0);
60 for (unsigned int i = 0; i < resolutions_mr_.size(); ++i) {
61 resolutions_mr_[i] =
62 static_cast<float>(pm_map_config->map_resolutions_[0] *
63 std::pow(pm_map_config->resolution_ratio_, i));
64 }
65
67}
std::shared_ptr< CompressionStrategy > compression_strategy_
@bried The compression strategy.
bool is_changed_
Has the map node been changed.
bool is_reserved_
If the node is reserved in map.
std::shared_ptr< BaseMapMatrixHandler > map_matrix_handler_
The class to load and create map matrix binary.
std::shared_ptr< BaseMapNodeConfig > map_node_config_
The map node config.
virtual void InitMapMatrix(const BaseMapConfig *map_config)
Initialize the map matrix.
static BaseMapMatrixHandler * AllocPyramidMapMatrixHandler(MapVersion version)

◆ Init() [2/2]

void apollo::localization::msf::pyramid_map::PyramidMapNode::Init ( const BaseMapConfig map_config,
const MapNodeIndex index,
bool  create_map_cells = true 
)
virtual

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

在文件 pyramid_map_node.cc69 行定义.

70 {
71 map_config_ = map_config;
72
73 map_node_config_.reset(new PyramidMapNodeConfig());
74 map_node_config_->node_index_ = index;
78 map_node_config_->has_map_version_ = false;
79 map_node_config_->has_body_md5_ = false;
80 } else {
81 map_node_config_->has_map_version_ = true;
82 map_node_config_->has_body_md5_ = true;
83 }
84
87 is_reserved_ = false;
88 data_is_ready_ = false;
89 is_changed_ = false;
90
91 map_matrix_.reset(new PyramidMapMatrix());
94 map_node_config_->map_version_));
95 compression_strategy_.reset(new ZlibStrategy());
96
97 if (create_map_cells) {
99 }
100}
static Eigen::Vector2d ComputeLeftTopCorner(const BaseMapConfig &config, const MapNodeIndex &index)

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