Apollo  6.0
Open source self driving car software
lossless_map.h
Go to the documentation of this file.
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 
17 #pragma once
18 
19 #include <vector>
20 
23 
24 namespace apollo {
25 namespace localization {
26 namespace msf {
27 
28 class LosslessMap : public BaseMap {
29  public:
30  explicit LosslessMap(LosslessMapConfig* config);
31  ~LosslessMap();
32 
33  public:
39  void SetValue(const Eigen::Vector3d& coordinate, int zone_id,
40  unsigned char intensity);
46  void SetValueLayer(const Eigen::Vector3d& coordinate, int zone_id,
47  unsigned char intensity);
51  void GetValue(const Eigen::Vector3d& coordinate, int zone_id,
52  unsigned int resolution_id, std::vector<unsigned char>* values);
57  void GetValueSafe(const Eigen::Vector3d& coordinate, int zone_id,
58  unsigned int resolution_id,
59  std::vector<unsigned char>* values);
63  void GetVar(const Eigen::Vector3d& coordinate, int zone_id,
64  unsigned int resolution_id, std::vector<float>* vars);
69  void GetVarSafe(const Eigen::Vector3d& coordinate, int zone_id,
70  unsigned int resolution_id, std::vector<float>* vars);
74  void GetAlt(const Eigen::Vector3d& coordinate, int zone_id,
75  unsigned int resolution_id, std::vector<float>* alts);
80  void GetAltSafe(const Eigen::Vector3d& coordinate, int zone_id,
81  unsigned int resolution_id, std::vector<float>* alts);
85  void GetAltVar(const Eigen::Vector3d& coordinate, int zone_id,
86  unsigned int resolution_id, std::vector<float>* alt_vars);
91  void GetAltVarSafe(const Eigen::Vector3d& coordinate, int zone_id,
92  unsigned int resolution_id, std::vector<float>* alt_vars);
94  void GetCount(const Eigen::Vector3d& coordinate, int zone_id,
95  unsigned int resolution_id, std::vector<unsigned int>* counts);
97  void GetCountSafe(const Eigen::Vector3d& coordinate, int zone_id,
98  unsigned int resolution_id,
99  std::vector<unsigned int>* counts);
102  unsigned char GetValue(const Eigen::Vector3d& coordinate, int zone_id,
103  unsigned int resolution_id);
107  unsigned char GetValueSafe(const Eigen::Vector3d& coordinate, int zone_id,
108  unsigned int resolution_id);
111  float GetVar(const Eigen::Vector3d& coordinate, int zone_id,
112  unsigned int resolution_id);
116  float GetVarSafe(const Eigen::Vector3d& coordinate, int zone_id,
117  unsigned int resolution_id);
120  float GetAlt(const Eigen::Vector3d& coordinate, int zone_id,
121  unsigned int resolution_id);
125  float GetAltSafe(const Eigen::Vector3d& coordinate, int zone_id,
126  unsigned int resolution_id);
129  float GetAltVar(const Eigen::Vector3d& coordinate, int zone_id,
130  unsigned int resolution_id);
134  float GetAltVarSafe(const Eigen::Vector3d& coordinate, int zone_id,
135  unsigned int resolution_id);
137  unsigned int GetCount(const Eigen::Vector3d& coordinate, int zone_id,
138  unsigned int resolution_id);
140  unsigned int GetCountSafe(const Eigen::Vector3d& coordinate, int zone_id,
141  unsigned int resolution_id);
143  void SetGroundHeightOffset(double height_offset);
150  virtual void PreloadMapArea(const Eigen::Vector3d& location,
151  const Eigen::Vector3d& trans_diff,
152  unsigned int resolution_id, unsigned int zone_id);
158  virtual bool LoadMapArea(const Eigen::Vector3d& seed_pt3d,
159  unsigned int resolution_id, unsigned int zone_id,
160  int filter_size_x, int filter_size_y);
161 };
162 
163 } // namespace msf
164 } // namespace localization
165 } // namespace apollo
The data structure of the base map.
Definition: base_map.h:35
void SetValue(const Eigen::Vector3d &coordinate, int zone_id, unsigned char intensity)
Set the value of a pixel in the map, including all the resolution levels.
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Eigen::Vector3d Vector3d
Definition: frame_transform.h:27
void SetValueLayer(const Eigen::Vector3d &coordinate, int zone_id, unsigned char intensity)
Set the vlaue of a pixel in a layer in the map node.
void GetAltSafe(const Eigen::Vector3d &coordinate, int zone_id, unsigned int resolution_id, std::vector< float > *alts)
Given the 3D global coordinate, this function loads the corresponding map node in the cache thread sa...
void GetAltVarSafe(const Eigen::Vector3d &coordinate, int zone_id, unsigned int resolution_id, std::vector< float > *alt_vars)
Given the 3D global coordinate, this function loads the corresponding map node in the cache thread sa...
void SetGroundHeightOffset(double height_offset)
Set the ground height offset.
void GetCount(const Eigen::Vector3d &coordinate, int zone_id, unsigned int resolution_id, std::vector< unsigned int > *counts)
Get the number of samples in the map cell.
LosslessMap(LosslessMapConfig *config)
void GetAltVar(const Eigen::Vector3d &coordinate, int zone_id, unsigned int resolution_id, std::vector< float > *alt_vars)
Given the 3D global coordinate, this function loads the corresponding map node in the cache and retur...
void GetValueSafe(const Eigen::Vector3d &coordinate, int zone_id, unsigned int resolution_id, std::vector< unsigned char > *values)
Given the 3D global coordinate, this function loads the corresponding map node in the cache thread sa...
The options of the reflectance map.
Definition: lossless_map_config.h:28
void GetAlt(const Eigen::Vector3d &coordinate, int zone_id, unsigned int resolution_id, std::vector< float > *alts)
Given the 3D global coordinate, this function loads the corresponding map node in the cache and retur...
virtual bool LoadMapArea(const Eigen::Vector3d &seed_pt3d, unsigned int resolution_id, unsigned int zone_id, int filter_size_x, int filter_size_y)
Load map nodes for the location calculate of this frame. If the forecasts are correct in last frame...
virtual void PreloadMapArea(const Eigen::Vector3d &location, const Eigen::Vector3d &trans_diff, unsigned int resolution_id, unsigned int zone_id)
Preload map nodes for the next frame location calculation. It will forecasts the nodes by the directi...
void GetValue(const Eigen::Vector3d &coordinate, int zone_id, unsigned int resolution_id, std::vector< unsigned char > *values)
Given the 3D global coordinate, this function loads the corresponding map node in the cache and retur...
Definition: lossless_map.h:28
void GetCountSafe(const Eigen::Vector3d &coordinate, int zone_id, unsigned int resolution_id, std::vector< unsigned int > *counts)
Get the number of samples in the map cell thread safely.
void GetVarSafe(const Eigen::Vector3d &coordinate, int zone_id, unsigned int resolution_id, std::vector< float > *vars)
Given the 3D global coordinate, this function loads the corresponding map node in the cache thread sa...
void GetVar(const Eigen::Vector3d &coordinate, int zone_id, unsigned int resolution_id, std::vector< float > *vars)
Given the 3D global coordinate, this function loads the corresponding map node in the cache and retur...