Apollo 11.0
自动驾驶开放平台
roi_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#include <vector>
21
22#include "Eigen/Dense"
23
27
28namespace apollo {
29namespace perception {
30namespace lidar {
31
33 public:
34 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
35
36 public:
37 using Vec2ui = Eigen::Matrix<size_t, 2, 1>;
38 enum class DirectionMajor { XMAJOR = 0, YMAJOR = 1 };
39
40 ROIServiceContent() = default;
41 ~ROIServiceContent() = default;
42
43 // @brief: get a copy of this service content
44 // @param [out]: copy of the service content
45 void GetCopy(SceneServiceContent* content) const override;
46
47 // @brief: set service content from outside
48 // @param [in]: input service content
49 void SetContent(const SceneServiceContent& content) override;
50
51 // @brief: get service content name
52 // @return: name
53 std::string Name() const override { return "ROIServiceContent"; }
54
55 // @brief: check bitmap bit
56 // @brief return true if bit has been set
57 inline bool CheckBit(const size_t loc, const uint64_t block) const;
58
59 // @brief: check if point in bitmp;
60 // @return: return true if point is in roi
61 bool Check(const Eigen::Vector3d& world_point) const;
62
63 public:
64 std::vector<uint64_t> bitmap_;
66 double cell_size_ = 0.25;
67 double range_ = 120.0;
68 DirectionMajor major_dir_ = DirectionMajor::XMAJOR;
69 Eigen::Vector3d transform_;
70};
71
72class ROIService : public SceneService {
73 public:
74 ROIService() = default;
76
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 "ROIService"; }
84
85 public:
86 bool QueryIsPointInROI(const Eigen::Vector3d& world_point);
87 bool QueryIsPointInROI(const Eigen::Vector3d& world_point,
88 const ROIServiceContent& content);
89
90 protected:
92};
93
94typedef std::shared_ptr<ROIServiceContent> ROIServiceContentPtr;
95typedef std::shared_ptr<const ROIServiceContent> ROIServiceContentConstPtr;
96
97typedef std::shared_ptr<ROIService> ROIServicePtr;
98typedef std::shared_ptr<const ROIService> ROIServiceConstPtr;
99
100} // namespace lidar
101} // namespace perception
102} // namespace apollo
bool Check(const Eigen::Vector3d &world_point) const
Eigen::Matrix< size_t, 2, 1 > Vec2ui
Definition roi_service.h:37
bool CheckBit(const size_t loc, const uint64_t block) const
std::string Name() const override
Definition roi_service.h:53
void GetCopy(SceneServiceContent *content) const override
void SetContent(const SceneServiceContent &content) override
bool QueryIsPointInROI(const Eigen::Vector3d &world_point)
std::string Name() const override
Definition roi_service.h:83
bool Init(const SceneServiceInitOptions &options=SceneServiceInitOptions()) override
std::shared_ptr< const ROIServiceContent > ROIServiceContentConstPtr
Definition roi_service.h:95
std::shared_ptr< ROIServiceContent > ROIServiceContentPtr
Definition roi_service.h:94
std::shared_ptr< ROIService > ROIServicePtr
Definition roi_service.h:97
std::shared_ptr< const ROIService > ROIServiceConstPtr
Definition roi_service.h:98
class register implement
Definition arena_queue.h:37