Apollo  6.0
Open source self driving car software
lossless_map_node.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 LosslessMapNode : public BaseMapNode {
29  public:
32 
37  void SetValue(const Eigen::Vector3d& coordinate, unsigned char intensity);
43  bool SetValueIfInBound(const Eigen::Vector3d& coordinate,
44  unsigned char intensity);
50  void SetValueLayer(const Eigen::Vector3d& coordinate,
51  unsigned char intensity);
54  void GetValue(const Eigen::Vector3d& coordinate,
55  std::vector<unsigned char>* values) const;
58  void GetVar(const Eigen::Vector3d& coordinate,
59  std::vector<float>* vars) const;
62  void GetAlt(const Eigen::Vector3d& coordinate,
63  std::vector<float>* alts) const;
66  void GetAltVar(const Eigen::Vector3d& coordinate,
67  std::vector<float>* alt_vars) const;
70  void GetCount(const Eigen::Vector3d& coordinate,
71  std::vector<unsigned int>* counts) const;
74  unsigned char GetValue(const Eigen::Vector3d& coordinate) const;
77  float GetVar(const Eigen::Vector3d& coordinate) const;
80  float GetAlt(const Eigen::Vector3d& coordinate) const;
83  float GetAltVar(const Eigen::Vector3d& coordinate) const;
86  unsigned int GetCount(const Eigen::Vector3d& coordinate) const;
88  unsigned char GetValue(unsigned int row, unsigned int col) const {
89  return static_cast<LosslessMapMatrix*>(map_matrix_)
90  ->GetMapCell(row, col)
91  .GetValue();
92  }
94  float GetVar(unsigned int row, unsigned int col) const {
95  return static_cast<LosslessMapMatrix*>(map_matrix_)
96  ->GetMapCell(row, col)
97  .GetVar();
98  }
100  float GetAlt(unsigned int row, unsigned int col) const {
101  return static_cast<LosslessMapMatrix*>(map_matrix_)
102  ->GetMapCell(row, col)
103  .GetAlt();
104  }
106  float GetAltVar(unsigned int row, unsigned int col) const {
107  return static_cast<LosslessMapMatrix*>(map_matrix_)
108  ->GetMapCell(row, col)
109  .GetAltVar();
110  }
112  unsigned int GetCount(unsigned int row, unsigned int col) const {
113  return static_cast<LosslessMapMatrix*>(map_matrix_)
114  ->GetMapCell(row, col)
115  .GetCount();
116  }
118  inline const LosslessMapSingleCell& GetFirstMapCell(unsigned int row,
119  unsigned int col) const {
120  return static_cast<LosslessMapMatrix*>(map_matrix_)
121  ->GetMapCell(row, col)
122  .map_cells[0];
123  }
124  inline LosslessMapSingleCell& GetFirstMapCell(unsigned int row,
125  unsigned int col) {
126  return static_cast<LosslessMapMatrix*>(map_matrix_)
127  ->GetMapCell(row, col)
128  .map_cells[0];
129  }
130 
132  inline float GetMinAltitude() const { return min_altitude_; }
134  inline void SetMinAltitude(float altitude) { min_altitude_ = altitude; }
135 
136  protected:
139 };
140 
141 } // namespace msf
142 } // namespace localization
143 } // namespace apollo
void SetValueLayer(const Eigen::Vector3d &coordinate, unsigned char intensity)
Set the value of a pixel in a layer in the map node.
float GetMinAltitude() const
Get the min altitude of point cloud in the node.
Definition: lossless_map_node.h:132
void SetValue(const Eigen::Vector3d &coordinate, unsigned char intensity)
Set the value of a pixel in the map node.
Definition: lossless_map_matrix.h:33
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
const LosslessMapSingleCell & GetFirstMapCell(unsigned int row, unsigned int col) const
Get the constant map cell given the coordinate.
Definition: lossless_map_node.h:118
void GetAlt(const Eigen::Vector3d &coordinate, std::vector< float > *alts) const
Given the 3D global coordinate, get the map cell&#39;s average altitude of each layer.
void GetVar(const Eigen::Vector3d &coordinate, std::vector< float > *vars) const
Given the 3D global coordinate, get the map cell variance of the intensity of each layer...
Eigen::Vector3d Vector3d
Definition: frame_transform.h:27
void SetMinAltitude(float altitude)
Set the min altitude of point cloud in the node.
Definition: lossless_map_node.h:134
LosslessMapSingleCell & GetFirstMapCell(unsigned int row, unsigned int col)
Definition: lossless_map_node.h:124
void GetCount(const Eigen::Vector3d &coordinate, std::vector< unsigned int > *counts) const
Given the 3D global coordinate, get the map cell&#39;s count of the samples of each layer.
Definition: lossless_map_matrix.h:143
Definition: lossless_map_node.h:28
float GetAltVar(unsigned int row, unsigned int col) const
Get the map cell&#39;s variance of the altitude.
Definition: lossless_map_node.h:106
float GetAlt(unsigned int row, unsigned int col) const
Get the map cell&#39;s average altitude.
Definition: lossless_map_node.h:100
void GetAltVar(const Eigen::Vector3d &coordinate, std::vector< float > *alt_vars) const
Given the 3D global coordinate, get the map cell&#39;s variance of the altitude of each layer...
float min_altitude_
The min altitude of point cloud in the node.
Definition: lossless_map_node.h:138
BaseMapMatrix * map_matrix_
The data structure of the map datas, which is a matrix.
Definition: base_map_node.h:178
unsigned int GetCount(unsigned int row, unsigned int col) const
Get the map cell&#39;s count of the samples.
Definition: lossless_map_node.h:112
unsigned char GetValue(unsigned int row, unsigned int col) const
Get the map cell average intensity.
Definition: lossless_map_node.h:88
void GetValue(const Eigen::Vector3d &coordinate, std::vector< unsigned char > *values) const
Given the 3D global coordinate, get the map cell average intensity of each layer. ...
bool SetValueIfInBound(const Eigen::Vector3d &coordinate, unsigned char intensity)
Set the value of a pixel in the map node if the pixel in the node.
float GetVar(unsigned int row, unsigned int col) const
Get the map cell variance of the intensity.
Definition: lossless_map_node.h:94
The data structure of a Node in the map.
Definition: base_map_node.h:32