Apollo  6.0
Open source self driving car software
base_detector.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 // SAMPLE CODE:
17 //
18 // class DefaultDetector : public BaseDetector {
19 // public:
20 // DefaultDetector() : BaseDetector() {}
21 // virtual ~DefaultDetector() {}
22 //
23 // virtual bool Init() override {
24 // // Do something.
25 // return true;
26 // }
27 //
28 // virtual bool Detect(
29 // const drivers::ContiRadar& corrected_obstacles,
30 // const DetectorOptions& options,
31 // base::FramePtr detected_frame) override {
32 // // Do something.
33 // return true;
34 // }
35 //
36 // virtual std::string Name() const override {
37 // return "DefaultDetector";
38 // }
39 //
40 // };
41 //
42 // // Register plugin.
43 // PERCEPTION_REGISTER_DETECTOR(DefaultDetector);
45 // USING CODE:
46 //
47 // BaseDetector* detector =
48 // BaseDetectorRegisterer::GetInstanceByName("DefaultDetector");
49 // using detector to do somethings.
50 // ////////////////////////////////////////////////////
51 
52 #pragma once
53 
54 #include <string>
55 
56 #include "Eigen/Core"
57 
58 #include "cyber/common/log.h"
59 #include "cyber/common/macros.h"
60 
61 #include "modules/drivers/proto/conti_radar.pb.h"
67 
68 namespace apollo {
69 namespace perception {
70 namespace radar {
71 
75  Eigen::Vector3f car_linear_speed = Eigen::Vector3f::Zero();
76  Eigen::Vector3f car_angular_speed = Eigen::Vector3f::Zero();
78 };
79 
80 class BaseDetector {
81  public:
82  BaseDetector() = default;
83  virtual ~BaseDetector() = default;
84 
85  virtual bool Init() = 0;
86 
87  // @brief: detect the objects from the corrected obstacles
88  // @param [in]: corrected obstacles.
89  // @param [in]: options.
90  // @param [out]: detected objects.
91  virtual bool Detect(const drivers::ContiRadar& corrected_obstacles,
92  const DetectorOptions& options,
93  base::FramePtr detected_frame) = 0;
94 
95  virtual std::string Name() const = 0;
96 
97  private:
99 };
100 
102 #define PERCEPTION_REGISTER_DETECTOR(name) \
103  PERCEPTION_REGISTER_CLASS(BaseDetector, name)
104 
105 } // namespace radar
106 } // namespace perception
107 } // namespace apollo
Definition: base_detector.h:72
Eigen::Matrix4d * radar2world_pose
Definition: base_detector.h:73
Eigen::Vector3f Vector3f
Definition: base_map_fwd.h:29
std::shared_ptr< Frame > FramePtr
Definition: frame.h:60
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
PERCEPTION_REGISTER_REGISTERER(BaseDetector)
#define DISALLOW_COPY_AND_ASSIGN(classname)
Definition: macros.h:48
Eigen::Matrix4d Matrix4d
Definition: base_map_fwd.h:32
Eigen::Vector3f car_linear_speed
Definition: base_detector.h:75
Eigen::Vector3f car_angular_speed
Definition: base_detector.h:76
base::HdmapStructPtr roi
Definition: base_detector.h:77
bool Init(const char *binary_name)
Definition: base_detector.h:80
std::shared_ptr< HdmapStruct > HdmapStructPtr
Definition: hdmap_struct.h:45
Eigen::Matrix4d * radar2novatel_trans
Definition: base_detector.h:74