Apollo  6.0
Open source self driving car software
pyramid_map_node.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2019 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 #pragma once
17 
18 #include <vector>
19 
20 #include "Eigen/Core"
21 
24 
25 namespace apollo {
26 namespace localization {
27 namespace msf {
28 namespace pyramid_map {
29 
30 class PyramidMapNode : public BaseMapNode {
31  public:
34 
35  public:
36  virtual void Init(const BaseMapConfig* map_config);
37  virtual void Init(const BaseMapConfig* map_config, const MapNodeIndex& index,
38  bool create_map_cells = true);
39 
41  void BottomUpSafe();
42 
46  void BottomUpBase();
47 
53  bool AddValueIfInBound(const Eigen::Vector3d& coordinate,
54  unsigned char intensity, unsigned int level = 0);
59  void AddValueIfInBound(const std::vector<Eigen::Vector3d>& coordinates,
60  const std::vector<unsigned char>& intensity,
61  unsigned int level = 0);
65  bool GetCoordinate(const Eigen::Vector2d& coordinate, unsigned int level,
66  unsigned int* x, unsigned int* y) const;
68  Eigen::Vector2d GetCoordinate(unsigned int level, unsigned int x,
69  unsigned int y) const;
70 
71  virtual bool GetCoordinate(const Eigen::Vector2d& coordinate, unsigned int* x,
72  unsigned int* y) const;
73  virtual bool GetCoordinate(const Eigen::Vector3d& coordinate, unsigned int* x,
74  unsigned int* y) const;
75 
76  virtual Eigen::Vector2d GetCoordinate(unsigned int x, unsigned int y) const;
77 
80  float GetIntensitySafe(const Eigen::Vector3d& coordinate,
81  unsigned int level = 0) const;
84  float GetIntensityVarSafe(const Eigen::Vector3d& coordinate,
85  unsigned int level = 0) const;
88  float GetAltitudeSafe(const Eigen::Vector3d& coordinate,
89  unsigned int level = 0) const;
92  float GetAltitudeVarSafe(const Eigen::Vector3d& coordinate,
93  unsigned int level = 0) const;
96  float GetGroundAltitudeSafe(const Eigen::Vector3d& coordinate,
97  unsigned int level = 0) const;
100  unsigned int GetCountSafe(const Eigen::Vector3d& coordinate,
101  unsigned int level = 0) const;
104  unsigned int GetGroundCountSafe(const Eigen::Vector3d& coordinate,
105  unsigned int level = 0) const;
106 
109  float GetIntensity(const Eigen::Vector3d& coordinate,
110  unsigned int level = 0) const;
113  float GetIntensityVar(const Eigen::Vector3d& coordinate,
114  unsigned int level = 0) const;
117  float GetAltitude(const Eigen::Vector3d& coordinate,
118  unsigned int level = 0) const;
121  float GetAltitudeVar(const Eigen::Vector3d& coordinate,
122  unsigned int level = 0) const;
125  float GetGroundAltitude(const Eigen::Vector3d& coordinate,
126  unsigned int level = 0) const;
129  unsigned int GetCount(const Eigen::Vector3d& coordinate,
130  unsigned int level = 0) const;
133  unsigned int GetGroundCount(const Eigen::Vector3d& coordinate,
134  unsigned int level = 0) const;
135 
137  double ComputeMeanIntensity(unsigned int level = 0);
138 
139  private:
140  std::vector<float> resolutions_mr_;
141 };
142 
143 } // namespace pyramid_map
144 } // namespace msf
145 } // namespace localization
146 } // namespace apollo
void BottomUpBase()
Propagate the data to the coarse resolution. only update count, intensity, intensity var and altitude...
double ComputeMeanIntensity(unsigned int level=0)
Compute mean intensity.
float GetIntensity(const Eigen::Vector3d &coordinate, unsigned int level=0) const
Given the 3D global coordinate, get the map cell intensity without check.
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Eigen::Vector2d Vector2d
Definition: base_map_fwd.h:36
float GetAltitude(const Eigen::Vector3d &coordinate, unsigned int level=0) const
Given the 3D global coordinate, get the map cell&#39;s average altitude without check.
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. <return> If global c...
float GetAltitudeVarSafe(const Eigen::Vector3d &coordinate, unsigned int level=0) const
Given the 3D global coordinate, get the map cell&#39;s variance of the altitude with check.
Eigen::Vector3d Vector3d
Definition: frame_transform.h:27
float GetAltitudeVar(const Eigen::Vector3d &coordinate, unsigned int level=0) const
Given the 3D global coordinate, get the map cell&#39;s variance of the altitude without check...
unsigned int GetGroundCount(const Eigen::Vector3d &coordinate, unsigned int level=0) const
Given the 3D global coordinate, get the map cell&#39;s count of the ground samples without check...
unsigned int GetGroundCountSafe(const Eigen::Vector3d &coordinate, unsigned int level=0) const
Given the 3D global coordinate, get the map cell&#39;s count of the ground samples with check...
float GetAltitudeSafe(const Eigen::Vector3d &coordinate, unsigned int level=0) const
Given the 3D global coordinate, get the map cell&#39;s average altitude with check.
void BottomUpSafe()
Propagate the data to the coarse resolution by check.
The data structure of a Node in the map.
Definition: base_map_node.h:37
unsigned int GetCount(const Eigen::Vector3d &coordinate, unsigned int level=0) const
Given the 3D global coordinate, get the map cell&#39;s count of the samples without check.
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.
float GetGroundAltitudeSafe(const Eigen::Vector3d &coordinate, unsigned int level=0) const
Given the 3D global coordinate, get the map cell&#39;s average ground altitude with check.
float GetGroundAltitude(const Eigen::Vector3d &coordinate, unsigned int level=0) const
Given the 3D global coordinate, get the map cell&#39;s average ground altitude without check...
float GetIntensitySafe(const Eigen::Vector3d &coordinate, unsigned int level=0) const
Given the 3D global coordinate, get the map cell intensity with check.
unsigned int GetCountSafe(const Eigen::Vector3d &coordinate, unsigned int level=0) const
Given the 3D global coordinate, get the map cell&#39;s count of the samples with check.
The options of the reflectance map.
Definition: base_map_config.h:42
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 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...
Definition: base_map_node_index.h:33
virtual void Init(const BaseMapConfig *map_config)
Initialize the map node. Call this function first before use it!