Apollo  6.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 
27 
28 namespace apollo {
29 namespace perception {
30 namespace lidar {
31 class HdmapROIFilterTest;
32 class HdmapROIFilter : public BaseROIFilter {
33  public:
35  : BaseROIFilter(),
36  range_(120.0),
37  cell_size_(0.25),
38  extend_dist_(0.0),
39  no_edge_table_(false) {}
40  ~HdmapROIFilter() = default;
41 
42  bool Init(const ROIFilterInitOptions& options) override;
43 
44  std::string Name() const override { return "HdmapROIFilter"; }
45 
46  bool Filter(const ROIFilterOptions& options, LidarFrame* frame) override;
47 
48  private:
49  void TransformFrame(
50  const base::PointFCloudPtr& cloud, const Eigen::Affine3d& vel_pose,
53  base::PointFCloudPtr* cloud_local);
54 
55  bool FilterWithPolygonMask(
56  const base::PointFCloudPtr& cloud,
58  base::PointIndices* roi_indices);
59 
60  bool Bitmap2dFilter(const base::PointFCloudPtr& in_cloud,
61  const Bitmap2D& bitmap, base::PointIndices* roi_indices);
62 
63  // parameters for polygons scans convert
64  double range_ = 120.0;
65  double cell_size_ = 0.25;
66  double extend_dist_ = 0.0;
67  bool no_edge_table_ = false;
68  bool set_roi_service_ = false;
71  Bitmap2D bitmap_;
72  ROIServiceContent roi_service_content_;
73 
74  // unit tests only
75  friend class HdmapROIFilterTest;
76  friend class LidarLibROIServiceTest;
77 };
78 
79 } // namespace lidar
80 } // namespace perception
81 } // namespace apollo
std::vector< EigenType, Eigen::aligned_allocator< EigenType > > EigenVector
Definition: eigen_defs.h:32
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Definition: base_roi_filter.h:32
Definition: bitmap2d.h:28
HdmapROIFilter()
Definition: hdmap_roi_filter.h:34
friend class HdmapROIFilterTest
Definition: hdmap_roi_filter.h:75
friend class LidarLibROIServiceTest
Definition: hdmap_roi_filter.h:76
Definition: base_roi_filter.h:30
std::string Name() const override
Definition: hdmap_roi_filter.h:44
bool Init(const ROIFilterInitOptions &options) override
Definition: lidar_frame.h:33
std::shared_ptr< PointFCloud > PointFCloudPtr
Definition: point_cloud.h:482
Definition: base_roi_filter.h:28
Eigen::Affine3d Affine3d
Definition: base_map_fwd.h:34
bool Filter(const ROIFilterOptions &options, LidarFrame *frame) override
Definition: hdmap_roi_filter.h:32