23namespace localization {
37 boost::property_tree::ptree config;
39 boost::property_tree::write_xml(file_path, config);
40 AINFO <<
"Saved the map configuration to: " << file_path;
45 boost::property_tree::ptree config;
46 boost::property_tree::read_xml(file_path, config);
48 std::string map_version = config.get<std::string>(
"map.map_config.version");
51 AINFO <<
"Loaded the map configuration from: " << file_path;
55 << map_version <<
" map.";
69 config->put(
"map.map_runtime.map_ground_height_offset",
76 config->add(
"map.map_record.datasets.dataset",
map_datasets_[i]);
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");
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();
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();
114 double max_resolutions = 0.0;
std::vector< float > map_resolutions_
The pixel resolutions in the map in meters.
void SetSingleResolutions(float resolution=0.125)
Set single resolutions.
std::vector< std::string > map_datasets_
The datasets that contributed to the map.
bool Load(const std::string file_path)
Load the map option from a XML file.
BaseMapConfig(std::string map_version="0.1")
The constructor gives the default map settings.
std::string map_version_
The version of map.
bool map_is_compression_
Enable the compression.
void ResizeMapRange()
Resize map range by range and resolutions.
float map_ground_height_offset_
Velodyne's height to the ground.
virtual void CreateXml(boost::property_tree::ptree *config) const
Create the XML structure.
std::string map_folder_path_
The map folder path.
void SetMultiResolutions()
Set multi resolutions.
virtual void LoadXml(const boost::property_tree::ptree &config)
Load the map options from a XML structure.
Rect2D< double > map_range_
The minimum and maximum UTM range in the map.
bool Save(const std::string file_path)
Save the map option to a XML file.
unsigned int map_node_size_y_
The map node size in pixels.
unsigned int map_node_size_x_
The map node size in pixels.
T GetMaxY() const
Get the max y of the rectangle.
T GetMaxX() const
Get the max x of the rectangle.
T GetMinX() const
Get the min x of the rectangle.
T GetMinY() const
Get the min y of the rectangle.