Apollo 11.0
自动驾驶开放平台
ground_service.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#pragma once
17
18#include <memory>
19#include <string>
20
25
26namespace apollo {
27namespace perception {
28namespace lidar {
29
31 public:
32 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
33
34 public:
37 // @brief: get a copy of this service content
38 // @param [out]: copy of the service content
39 void GetCopy(SceneServiceContent* content) const override;
40 // @brief: set service content from outside
41 // @param [in]: input service content
42 void SetContent(const SceneServiceContent& content) override;
43 // @brief: get service content name
44 // @return: name
45 std::string Name() const override { return "GroundServiceContent"; }
46 bool Init(double roi_x, double roi_y, uint32_t rows, uint32_t cols);
47
48 public:
49 // @brief: mapping function from point to grid index
50 // @param [in]: point in world frame
51 // @param [out] grid index
52 // @return: false if exceeding the range
53 bool PointToGrid(const Eigen::Vector3d& world_point,
54 uint32_t* grid_index) const;
55 // @brief: compute distance of point to ground plane
56 // @param [in]: point in world frame
57 // @return: distance
58 float PointToPlaneDistance(const Eigen::Vector3d& world_point) const;
59
60 public:
62 Eigen::Vector3d grid_center_;
63 uint32_t rows_ = 0; // y
64 uint32_t cols_ = 0; // x
65 double resolution_x_ = 0.0;
66 double resolution_y_ = 0.0;
67 double bound_x_min_ = 0.0;
68 double bound_y_min_ = 0.0;
69 double bound_x_max_ = 0.0;
70 double bound_y_max_ = 0.0;
71};
72
74 public:
75 GroundService() = default;
77 // @brief: initialize scene service
78 // @param [in]: init options
79 bool Init(const SceneServiceInitOptions& options =
80 SceneServiceInitOptions()) override;
81 // @brief: get service name
82 // @return: name
83 std::string Name() const override { return "GroundService"; }
84
88
89 public:
90 // @brief: Query point to ground distance
91 // @param [in]: point in world frame
92 // @return: distance
93 float QueryPointToGroundDistance(const Eigen::Vector3d& world_point);
94 // @brief: Query point to ground distance
95 // @param [in]: point in world frame
96 // @param [in]: outside service content
97 // @return: distance
98 float QueryPointToGroundDistance(const Eigen::Vector3d& world_point,
99 const GroundServiceContent& content);
100
101 protected:
103};
104
105typedef std::shared_ptr<GroundServiceContent> GroundServiceContentPtr;
106typedef std::shared_ptr<const GroundServiceContent>
108
109typedef std::shared_ptr<GroundService> GroundServicePtr;
110typedef std::shared_ptr<const GroundService> GroundServiceConstPtr;
111
112} // namespace lidar
113} // namespace perception
114} // namespace apollo
bool PointToGrid(const Eigen::Vector3d &world_point, uint32_t *grid_index) const
bool Init(double roi_x, double roi_y, uint32_t rows, uint32_t cols)
void SetContent(const SceneServiceContent &content) override
void GetCopy(SceneServiceContent *content) const override
float PointToPlaneDistance(const Eigen::Vector3d &world_point) const
std::string Name() const override
bool Init(const SceneServiceInitOptions &options=SceneServiceInitOptions()) override
float QueryPointToGroundDistance(const Eigen::Vector3d &world_point)
GroundServiceContent * GetGroundServiceContent() const
std::shared_ptr< const GroundService > GroundServiceConstPtr
std::shared_ptr< const GroundServiceContent > GroundServiceContentConstPtr
std::shared_ptr< GroundServiceContent > GroundServiceContentPtr
std::shared_ptr< GroundService > GroundServicePtr
class register implement
Definition arena_queue.h:37