Apollo  v5.5.0
Open source self driving car software
hdmap_roi_filter.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 <string>
20 #include <vector>
21 
26 
27 namespace apollo {
28 namespace perception {
29 namespace lidar {
30 class HdmapROIFilterTest;
31 class HdmapROIFilter : public BaseROIFilter {
32  public:
34  : BaseROIFilter(),
35  range_(120.0),
36  cell_size_(0.25),
37  extend_dist_(0.0),
38  no_edge_table_(false) {}
39  ~HdmapROIFilter() = default;
40 
41  bool Init(const ROIFilterInitOptions& options) override;
42 
43  std::string Name() const override { return "HdmapROIFilter"; }
44 
45  bool Filter(const ROIFilterOptions& options, LidarFrame* frame) override;
46 
47  private:
48  void TransformFrame(const base::PointFCloudPtr& cloud,
49  const Eigen::Affine3d& vel_pose,
50  const std::vector<base::PolygonDType*>& polygons_world,
51  std::vector<base::PolygonDType>* polygons_local,
52  base::PointFCloudPtr* cloud_local);
53 
54  bool FilterWithPolygonMask(
55  const base::PointFCloudPtr& cloud,
56  const std::vector<base::PolygonDType>& map_polygons,
57  base::PointIndices* roi_indices);
58 
59  bool Bitmap2dFilter(const base::PointFCloudPtr& in_cloud,
60  const Bitmap2D& bitmap, base::PointIndices* roi_indices);
61 
62  // parameters for polygons scans convert
63  double range_ = 120.0;
64  double cell_size_ = 0.25;
65  double extend_dist_ = 0.0;
66  bool no_edge_table_ = false;
67  bool set_roi_service_ = false;
68  std::vector<base::PolygonDType*> polygons_world_;
69  std::vector<base::PolygonDType> polygons_local_;
70  Bitmap2D bitmap_;
71  ROIServiceContent roi_service_content_;
72 
73  // unit tests only
74  friend class HdmapROIFilterTest;
75  friend class LidarLibROIServiceTest;
76 };
77 
78 } // namespace lidar
79 } // namespace perception
80 } // namespace apollo
Definition: blob.h:72
Definition: base_roi_filter.h:32
Definition: bitmap2d.h:28
HdmapROIFilter()
Definition: hdmap_roi_filter.h:33
friend class HdmapROIFilterTest
Definition: hdmap_roi_filter.h:74
friend class LidarLibROIServiceTest
Definition: hdmap_roi_filter.h:75
Definition: base_roi_filter.h:30
std::string Name() const override
Definition: hdmap_roi_filter.h:43
bool Init(const ROIFilterInitOptions &options) override
Definition: lidar_frame.h:33
std::shared_ptr< PointFCloud > PointFCloudPtr
Definition: point_cloud.h:472
Definition: base_roi_filter.h:28
bool Filter(const ROIFilterOptions &options, LidarFrame *frame) override
Definition: hdmap_roi_filter.h:31