Apollo 11.0
自动驾驶开放平台
lossy_map_matrix_2d.h
浏览该文件的文档.
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
21
22namespace apollo {
23namespace localization {
24namespace msf {
25
30 inline void Reset();
31 // /**@brief Load the map cell from a binary chunk.
32 // * @param <return> The size read (the real size of object).
33 // */
34 // inline unsigned int LoadBinary(unsigned char * buf);
35 // /**@brief Create the binary. Serialization of the object.
36 // * @param <buf, buf_size> The buffer and its size.
37 // * @param <return> The required or the used size of is returned.
38 // */
39 // inline unsigned int CreateBinary(unsigned char * buf, unsigned int
40 // buf_size) const;
41 // /**@brief Get the binary size of the object. */
42 // inline unsigned int GetBinarySize() const;
46 unsigned int count;
48 float intensity;
52 float altitude;
57};
58
60 public:
64
65 virtual void Init(const BaseMapConfig* config);
67 virtual void Reset(const BaseMapConfig* config);
68
69 void Init(unsigned int rows, unsigned int cols);
70 void Reset(unsigned int rows, unsigned int cols);
71
75 virtual unsigned int LoadBinary(unsigned char* buf);
80 virtual unsigned int CreateBinary(unsigned char* buf,
81 unsigned int buf_size) const;
83 virtual unsigned int GetBinarySize() const;
85 virtual void GetIntensityImg(cv::Mat* intensity_img) const;
86
87 inline LossyMapCell2D* operator[](int row) {
88 return map_cells_ + row * cols_;
89 }
90 inline const LossyMapCell2D* operator[](int row) const {
91 return map_cells_ + row * cols_;
92 }
93
95
96 protected:
98 unsigned int rows_;
100 unsigned int cols_;
103
104 protected:
105 inline unsigned char EncodeIntensity(const LossyMapCell2D& cell) const;
106 inline void DecodeIntensity(unsigned char data, LossyMapCell2D* cell) const;
107 inline uint16_t EncodeVar(const LossyMapCell2D& cell) const;
108 inline void DecodeVar(uint16_t data, LossyMapCell2D* cell) const;
109 inline uint16_t EncodeAltitudeGround(const LossyMapCell2D& cell) const;
110 inline void DecodeAltitudeGround(uint16_t data, LossyMapCell2D* cell) const;
111 inline uint16_t EncodeAltitudeAvg(const LossyMapCell2D& cell) const;
112 inline void DecodeAltitudeAvg(uint16_t data, LossyMapCell2D* cell) const;
113 inline unsigned char EncodeCount(const LossyMapCell2D& cell) const;
114 inline void DecodeCount(unsigned char data, LossyMapCell2D* cell) const;
115 const int var_range_ = 1023; // 65535;
116 const int var_ratio_ = 4; // 256;
117 // const unsigned int _alt_range = 1023;//65535;
118 const float alt_ground_interval_ = 0.04f;
119 const uint16_t ground_void_flag_ = 0xffff;
120 const float alt_avg_interval_ = 0.04f;
121 const int count_range_ = 2; // 30;
122 mutable float alt_avg_min_;
123 mutable float alt_avg_max_;
124 mutable float alt_ground_min_;
125 mutable float alt_ground_max_;
126};
127
128} // namespace msf
129} // namespace localization
130} // namespace apollo
The options of the reflectance map.
The data structure of the map cells in a map node.
unsigned char EncodeCount(const LossyMapCell2D &cell) const
virtual unsigned int LoadBinary(unsigned char *buf)
Load the map cell from a binary chunk.
LossyMapMatrix2D & operator=(const LossyMapMatrix2D &matrix)
virtual unsigned int CreateBinary(unsigned char *buf, unsigned int buf_size) const
Create the binary.
void DecodeCount(unsigned char data, LossyMapCell2D *cell) const
void DecodeAltitudeGround(uint16_t data, LossyMapCell2D *cell) const
virtual void GetIntensityImg(cv::Mat *intensity_img) const
get intensity image of node.
void DecodeVar(uint16_t data, LossyMapCell2D *cell) const
void DecodeAltitudeAvg(uint16_t data, LossyMapCell2D *cell) const
void DecodeIntensity(unsigned char data, LossyMapCell2D *cell) const
uint16_t EncodeVar(const LossyMapCell2D &cell) const
uint16_t EncodeAltitudeAvg(const LossyMapCell2D &cell) const
const LossyMapCell2D * operator[](int row) const
unsigned int cols_
The number of columns.
uint16_t EncodeAltitudeGround(const LossyMapCell2D &cell) const
unsigned char EncodeIntensity(const LossyMapCell2D &cell) const
LossyMapCell2D * map_cells_
The matrix data structure.
virtual unsigned int GetBinarySize() const
Get the binary size of the object.
virtual void Init(const BaseMapConfig *config)
Initialize the map matrix.
virtual void Reset(const BaseMapConfig *config)
Reset map cells data.
class register implement
Definition arena_queue.h:37
bool is_ground_useful
is ground altitude usefu
float altitude_ground
The ground altitude of the cell.
float intensity
The average intensity value.
float altitude
The average altitude of the cell.
float intensity_var
The variance intensity value.
unsigned int count
The number of samples in the cell.
LossyMapCell2D & operator=(const LossyMapCell2D &ref)
Overloading the assign operator.