Apollo 11.0
自动驾驶开放平台
ndt_map_config.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
18
19#include <algorithm>
20#include <string>
21
22namespace apollo {
23namespace localization {
24namespace msf {
25
26NdtMapConfig::NdtMapConfig(std::string map_version)
27 : BaseMapConfig(map_version) {
29 map_resolutions_z_.push_back(1.0f);
30}
31
32void NdtMapConfig::SetSingleResolutionZ(float resolution) {
33 map_resolutions_z_.clear();
34 map_resolutions_z_.push_back(resolution);
35}
36
38 map_resolutions_z_.clear();
39 map_resolutions_z_.push_back(0.03125);
40 map_resolutions_z_.push_back(0.0625);
41 map_resolutions_z_.push_back(0.125);
42 map_resolutions_z_.push_back(0.25);
43 map_resolutions_z_.push_back(0.5);
44 map_resolutions_z_.push_back(1);
45 map_resolutions_z_.push_back(2);
46 map_resolutions_z_.push_back(4);
47 map_resolutions_z_.push_back(8);
48 map_resolutions_z_.push_back(16);
49}
50
51void NdtMapConfig::CreateXml(boost::property_tree::ptree* config) const {
53 config->put("map.map_config.compression", map_is_compression_);
54 for (size_t i = 0; i < map_resolutions_.size(); ++i) {
55 config->add("map.map_config.resolutions_z.resolution",
57 }
58}
59
60void NdtMapConfig::LoadXml(boost::property_tree::ptree* config) {
62 map_is_compression_ = config->get<bool>("map.map_config.compression");
63 map_resolutions_z_.clear();
64 const auto& resolutions_z = config->get_child("map.map_config.resolutions_z");
65 std::for_each(resolutions_z.begin(), resolutions_z.end(),
66 [this](const boost::property_tree::ptree::value_type& v) {
67 map_resolutions_z_.push_back(
68 static_cast<float>(atof(v.second.data().c_str())));
69 });
70}
71
72} // namespace msf
73} // namespace localization
74} // namespace apollo
The options of the reflectance map.
std::vector< float > map_resolutions_
The pixel resolutions in the map in meters.
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.
virtual void LoadXml(boost::property_tree::ptree *config)
Load the map options from a XML structure.
virtual void CreateXml(boost::property_tree::ptree *config) const
Create the XML structure.
NdtMapConfig(std::string map_version="0.1")
The constructor gives the default map settings.
bool map_is_compression_
Enable the compression.
void SetMultiResolutionsZ()
Set multi resolutions.
void SetSingleResolutionZ(float resolution=1.0f)
Set single resolutions.
std::vector< float > map_resolutions_z_
The resolution of z-axis.
class register implement
Definition arena_queue.h:37