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

The options of the reflectance map. 更多...

#include <base_map_config.h>

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

Public 成员函数

 BaseMapConfig (std::string map_version="0.1")
 The constructor gives the default map settings.
 
bool Save (const std::string file_path)
 Save the map option to a XML file.
 
bool Load (const std::string file_path)
 Load the map option from a XML file.
 
void ResizeMapRange ()
 Resize map range by range and resolutions.
 
void SetSingleResolutions (float resolution=0.125)
 Set single resolutions.
 
void SetMultiResolutions ()
 Set multi resolutions.
 

Public 属性

std::string map_version_
 The version of map.
 
std::vector< float > map_resolutions_
 The pixel resolutions in the map in meters.
 
unsigned int map_node_size_x_
 The map node size in pixels.
 
unsigned int map_node_size_y_
 The map node size in pixels.
 
Rect2D< double > map_range_
 The minimum and maximum UTM range in the map.
 
float map_ground_height_offset_
 Velodyne's height to the ground.
 
bool map_is_compression_
 Enable the compression.
 
std::string map_folder_path_
 The map folder path.
 
std::vector< std::string > map_datasets_
 The datasets that contributed to the map.
 

Protected 成员函数

virtual void CreateXml (boost::property_tree::ptree *config) const
 Create the XML structure.
 
virtual void LoadXml (const boost::property_tree::ptree &config)
 Load the map options from a XML structure.
 

详细描述

The options of the reflectance map.

在文件 base_map_config.h32 行定义.

构造及析构函数说明

◆ BaseMapConfig()

apollo::localization::msf::BaseMapConfig::BaseMapConfig ( std::string  map_version = "0.1")
explicit

The constructor gives the default map settings.

在文件 base_map_config.cc26 行定义.

26 {
27 map_resolutions_.push_back(0.125); // Resolution: 0.125m in level 2
28 map_node_size_x_ = 1024; // in pixels
29 map_node_size_y_ = 1024; // in pixels
30 map_range_ = Rect2D<double>(0, 0, 1000448.0, 10000384.0); // in meters
31
32 map_version_ = map_version;
33 map_folder_path_ = ".";
34}
std::vector< float > map_resolutions_
The pixel resolutions in the map in meters.
std::string map_version_
The version of map.
std::string map_folder_path_
The map folder path.
Rect2D< double > map_range_
The minimum and maximum UTM range in the map.
unsigned int map_node_size_y_
The map node size in pixels.
unsigned int map_node_size_x_
The map node size in pixels.

成员函数说明

◆ CreateXml()

void apollo::localization::msf::BaseMapConfig::CreateXml ( boost::property_tree::ptree *  config) const
protectedvirtual

Create the XML structure.

apollo::localization::msf::LosslessMapConfig, apollo::localization::msf::LossyMapConfig2D , 以及 apollo::localization::msf::NdtMapConfig 重载.

在文件 base_map_config.cc60 行定义.

60 {
61 config->put("map.map_config.version", map_version_);
62 config->put("map.map_config.node_size.x", map_node_size_x_);
63 config->put("map.map_config.node_size.y", map_node_size_y_);
64 config->put("map.map_config.range.min_x", map_range_.GetMinX());
65 config->put("map.map_config.range.min_y", map_range_.GetMinY());
66 config->put("map.map_config.range.max_x", map_range_.GetMaxX());
67 config->put("map.map_config.range.max_y", map_range_.GetMaxY());
68 config->put("map.map_config.compression", map_is_compression_);
69 config->put("map.map_runtime.map_ground_height_offset",
71 for (size_t i = 0; i < map_resolutions_.size(); ++i) {
72 config->add("map.map_config.resolutions.resolution", map_resolutions_[i]);
73 }
74
75 for (size_t i = 0; i < map_datasets_.size(); ++i) {
76 config->add("map.map_record.datasets.dataset", map_datasets_[i]);
77 }
78}
std::vector< std::string > map_datasets_
The datasets that contributed to the map.
bool map_is_compression_
Enable the compression.
float map_ground_height_offset_
Velodyne's height to the ground.
T GetMaxY() const
Get the max y of the rectangle.
Definition rect2d.h:88
T GetMaxX() const
Get the max x of the rectangle.
Definition rect2d.h:83
T GetMinX() const
Get the min x of the rectangle.
Definition rect2d.h:73
T GetMinY() const
Get the min y of the rectangle.
Definition rect2d.h:78

◆ Load()

bool apollo::localization::msf::BaseMapConfig::Load ( const std::string  file_path)

Load the map option from a XML file.

在文件 base_map_config.cc44 行定义.

44 {
45 boost::property_tree::ptree config;
46 boost::property_tree::read_xml(file_path, config);
47
48 std::string map_version = config.get<std::string>("map.map_config.version");
49 if (map_version_ == map_version) {
50 LoadXml(config);
51 AINFO << "Loaded the map configuration from: " << file_path;
52 return true;
53 } else {
54 AERROR << "[Fatal Error] Expect v" << map_version_ << " map, but found v"
55 << map_version << " map.";
56 return false;
57 }
58}
virtual void LoadXml(const boost::property_tree::ptree &config)
Load the map options from a XML structure.
#define AERROR
Definition log.h:44
#define AINFO
Definition log.h:42

◆ LoadXml()

void apollo::localization::msf::BaseMapConfig::LoadXml ( const boost::property_tree::ptree &  config)
protectedvirtual

Load the map options from a XML structure.

apollo::localization::msf::LosslessMapConfig , 以及 apollo::localization::msf::LossyMapConfig2D 重载.

在文件 base_map_config.cc80 行定义.

80 {
81 map_resolutions_.clear();
82 map_datasets_.clear();
83 map_node_size_x_ = config.get<unsigned int>("map.map_config.node_size.x");
84 map_node_size_y_ = config.get<unsigned int>("map.map_config.node_size.y");
85 double min_x = config.get<double>("map.map_config.range.min_x");
86 double min_y = config.get<double>("map.map_config.range.min_y");
87 double max_x = config.get<double>("map.map_config.range.max_x");
88 double max_y = config.get<double>("map.map_config.range.max_y");
89 map_range_ = Rect2D<double>(min_x, min_y, max_x, max_y);
90 map_is_compression_ = config.get<bool>("map.map_config.compression");
92 config.get<float>("map.map_runtime.map_ground_height_offset");
93 const auto& resolutions = config.get_child("map.map_config.resolutions");
94 std::for_each(resolutions.begin(), resolutions.end(),
95 [this](const boost::property_tree::ptree::value_type& v) {
96 map_resolutions_.push_back(
97 static_cast<float>(atof(v.second.data().c_str())));
98 AINFO << "Resolution: " << v.second.data();
99 });
100 const auto& datasets = config.get_child("map.map_record.datasets");
101 std::for_each(datasets.begin(), datasets.end(),
102 [this](const boost::property_tree::ptree::value_type& v) {
103 map_datasets_.push_back(v.second.data());
104 AINFO << "Dataset: " << v.second.data();
105 });
106}

◆ ResizeMapRange()

void apollo::localization::msf::BaseMapConfig::ResizeMapRange ( )

Resize map range by range and resolutions.

在文件 base_map_config.cc108 行定义.

108 {
109 double min_x = 0;
110 double min_y = 0;
111 double max_x = 0;
112 double max_y = 0;
113
114 double max_resolutions = 0.0;
115 for (std::size_t i = 0; i < map_resolutions_.size(); ++i) {
116 if (max_resolutions < map_resolutions_[i]) {
117 max_resolutions = map_resolutions_[i];
118 }
119 }
120
121 int n = 0;
122 while (true) {
123 if (min_x < map_range_.GetMinX()) {
124 break;
125 }
126 ++n;
127 min_x -= n * map_node_size_x_ * max_resolutions;
128 }
129 n = 0;
130 while (true) {
131 if (min_y < map_range_.GetMinY()) {
132 break;
133 }
134 ++n;
135 min_y -= n * map_node_size_y_ * max_resolutions;
136 }
137 n = 0;
138 while (true) {
139 if (max_x > map_range_.GetMaxX()) {
140 break;
141 }
142 ++n;
143 max_x += n * map_node_size_x_ * max_resolutions;
144 }
145 n = 0;
146 while (true) {
147 if (max_y > map_range_.GetMaxY()) {
148 break;
149 }
150 ++n;
151 max_y += n * map_node_size_y_ * max_resolutions;
152 }
153 map_range_ = Rect2D<double>(min_x, min_y, max_x, max_y);
154}

◆ Save()

bool apollo::localization::msf::BaseMapConfig::Save ( const std::string  file_path)

Save the map option to a XML file.

在文件 base_map_config.cc36 行定义.

36 {
37 boost::property_tree::ptree config;
38 CreateXml(&config);
39 boost::property_tree::write_xml(file_path, config);
40 AINFO << "Saved the map configuration to: " << file_path;
41 return true;
42}
virtual void CreateXml(boost::property_tree::ptree *config) const
Create the XML structure.

◆ SetMultiResolutions()

void apollo::localization::msf::BaseMapConfig::SetMultiResolutions ( )

Set multi resolutions.

在文件 base_map_config.cc161 行定义.

161 {
162 map_resolutions_.clear();
163 map_resolutions_.push_back(0.03125);
164 map_resolutions_.push_back(0.0625);
165 map_resolutions_.push_back(0.125);
166 map_resolutions_.push_back(0.25);
167 map_resolutions_.push_back(0.5);
168 map_resolutions_.push_back(1);
169 map_resolutions_.push_back(2);
170 map_resolutions_.push_back(4);
171 map_resolutions_.push_back(8);
172 map_resolutions_.push_back(16);
173}

◆ SetSingleResolutions()

void apollo::localization::msf::BaseMapConfig::SetSingleResolutions ( float  resolution = 0.125)

Set single resolutions.

在文件 base_map_config.cc156 行定义.

156 {
157 map_resolutions_.clear();
158 map_resolutions_.push_back(resolution);
159}

类成员变量说明

◆ map_datasets_

std::vector<std::string> apollo::localization::msf::BaseMapConfig::map_datasets_

The datasets that contributed to the map.

在文件 base_map_config.h71 行定义.

◆ map_folder_path_

std::string apollo::localization::msf::BaseMapConfig::map_folder_path_

The map folder path.

在文件 base_map_config.h69 行定义.

◆ map_ground_height_offset_

float apollo::localization::msf::BaseMapConfig::map_ground_height_offset_

Velodyne's height to the ground.

Estimate the Velodyne's height based on the ground height.

在文件 base_map_config.h64 行定义.

◆ map_is_compression_

bool apollo::localization::msf::BaseMapConfig::map_is_compression_

Enable the compression.

在文件 base_map_config.h66 行定义.

◆ map_node_size_x_

unsigned int apollo::localization::msf::BaseMapConfig::map_node_size_x_

The map node size in pixels.

在文件 base_map_config.h52 行定义.

◆ map_node_size_y_

unsigned int apollo::localization::msf::BaseMapConfig::map_node_size_y_

The map node size in pixels.

在文件 base_map_config.h54 行定义.

◆ map_range_

Rect2D<double> apollo::localization::msf::BaseMapConfig::map_range_

The minimum and maximum UTM range in the map.

The x direction is the easting in UTM coordinate. The y direction is the northing in UTM coordinate.

在文件 base_map_config.h60 行定义.

◆ map_resolutions_

std::vector<float> apollo::localization::msf::BaseMapConfig::map_resolutions_

The pixel resolutions in the map in meters.

在文件 base_map_config.h50 行定义.

◆ map_version_

std::string apollo::localization::msf::BaseMapConfig::map_version_

The version of map.

在文件 base_map_config.h48 行定义.


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