Apollo 10.0
自动驾驶开放平台
pyramid_map_matrix_handler.h
浏览该文件的文档.
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 <memory>
19
22
23namespace apollo {
24namespace localization {
25namespace msf {
26namespace pyramid_map {
27
35
37 public:
39 virtual ~LossyMapMatrixHandler();
40
41 protected:
42 virtual unsigned char EncodeIntensity(float intensity) const;
43 virtual void DecodeIntensity(unsigned char data, float* intensity) const;
44 virtual uint16_t EncodeIntensityVar(float var) const;
45 virtual void DecodeIntensityVar(uint16_t data, float* var) const;
46 virtual uint16_t EncodeAltitude(float altitude, float min_altitude,
47 float altitude_interval) const;
48 virtual void DecodeAltitude(uint16_t data, float min_altitude,
49 float altitude_interval, float* altitude) const;
50 virtual unsigned char EncodeCount(unsigned int count,
51 unsigned int count_range) const;
52 virtual void DecodeCount(unsigned char data, unsigned int* count) const;
53 const unsigned int var_range_ = 1023; // 65535;
54 const unsigned int var_ratio_ = 4; // 256;
55 const unsigned int count_range_ = 2; // 31;
56 const float ground_alt_interval_ = 0.04f;
57 const float alt_avg_interval_ = 0.04f;
58 mutable float alt_avg_min_ = 0.0f;
59 mutable float ground_alt_min_ = 0.0f;
60 mutable float alt_avg_max_ = 0.0f;
61 mutable float ground_alt_max_ = 0.0f;
62};
63
65 public:
68
69 virtual size_t LoadBinary(const unsigned char* buf,
70 std::shared_ptr<BaseMapMatrix> matrix);
71 virtual size_t CreateBinary(const std::shared_ptr<BaseMapMatrix> matrix,
72 unsigned char* buf, size_t buf_size);
73 virtual size_t GetBinarySize(const std::shared_ptr<BaseMapMatrix> matrix);
74};
75
77 public:
80 virtual size_t LoadBinary(const unsigned char* buf,
81 std::shared_ptr<BaseMapMatrix> matrix);
82 virtual size_t CreateBinary(const std::shared_ptr<BaseMapMatrix> matrix,
83 unsigned char* buf, size_t buf_size);
84 virtual size_t GetBinarySize(const std::shared_ptr<BaseMapMatrix> matrix);
85};
86
88 public:
91 virtual size_t LoadBinary(const unsigned char* buf,
92 std::shared_ptr<BaseMapMatrix> matrix);
93 virtual size_t CreateBinary(const std::shared_ptr<BaseMapMatrix> matrix,
94 unsigned char* buf, size_t buf_size);
95 virtual size_t GetBinarySize(const std::shared_ptr<BaseMapMatrix> matrix);
96};
97
99 public:
102 virtual size_t LoadBinary(const unsigned char* buf,
103 std::shared_ptr<BaseMapMatrix> matrix);
104 virtual size_t CreateBinary(const std::shared_ptr<BaseMapMatrix> matrix,
105 unsigned char* buf, size_t buf_size);
106 virtual size_t GetBinarySize(const std::shared_ptr<BaseMapMatrix> matrix);
107};
108
109} // namespace pyramid_map
110} // namespace msf
111} // namespace localization
112} // namespace apollo
virtual size_t LoadBinary(const unsigned char *buf, std::shared_ptr< BaseMapMatrix > matrix)
Load the map cell from a binary chunk.
virtual size_t GetBinarySize(const std::shared_ptr< BaseMapMatrix > matrix)
Get the binary size of the object.
virtual size_t CreateBinary(const std::shared_ptr< BaseMapMatrix > matrix, unsigned char *buf, size_t buf_size)
Create the binary.
virtual size_t LoadBinary(const unsigned char *buf, std::shared_ptr< BaseMapMatrix > matrix)
Load the map cell from a binary chunk.
virtual size_t CreateBinary(const std::shared_ptr< BaseMapMatrix > matrix, unsigned char *buf, size_t buf_size)
Create the binary.
virtual size_t GetBinarySize(const std::shared_ptr< BaseMapMatrix > matrix)
Get the binary size of the object.
virtual unsigned char EncodeCount(unsigned int count, unsigned int count_range) const
virtual uint16_t EncodeAltitude(float altitude, float min_altitude, float altitude_interval) const
virtual void DecodeIntensity(unsigned char data, float *intensity) const
virtual void DecodeAltitude(uint16_t data, float min_altitude, float altitude_interval, float *altitude) const
virtual void DecodeCount(unsigned char data, unsigned int *count) const
virtual size_t LoadBinary(const unsigned char *buf, std::shared_ptr< BaseMapMatrix > matrix)
Load the map cell from a binary chunk.
virtual size_t CreateBinary(const std::shared_ptr< BaseMapMatrix > matrix, unsigned char *buf, size_t buf_size)
Create the binary.
virtual size_t GetBinarySize(const std::shared_ptr< BaseMapMatrix > matrix)
Get the binary size of the object.
virtual size_t GetBinarySize(const std::shared_ptr< BaseMapMatrix > matrix)
Get the binary size of the object.
virtual size_t LoadBinary(const unsigned char *buf, std::shared_ptr< BaseMapMatrix > matrix)
Load the map cell from a binary chunk.
virtual size_t CreateBinary(const std::shared_ptr< BaseMapMatrix > matrix, unsigned char *buf, size_t buf_size)
Create the binary.
static BaseMapMatrixHandler * AllocPyramidMapMatrixHandler(MapVersion version)
class register implement
Definition arena_queue.h:37