Apollo  6.0
Open source self driving car software
base_tracker.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 MyTracker : public BaseTracker {
19 // public:
20 // MyTracker() : BaseTracker() {}
21 // virtual ~MyTracker() {}
22 //
23 // virtual bool Init() override {
24 // // Do something.
25 // return true;
26 // }
27 //
28 // virtual bool Track(
29 // const base::Frame& detected_frame,
30 // const TrackerOptions& options,
31 // base::FramePtr tracked_frame) override {
32 // // Do something.
33 // return true;
34 // }
35 //
36 // virtual std::string Name() const override {
37 // return "MyTracker";
38 // }
39 //
40 // };
41 //
42 // // Register plugin.
43 // PERCEPTION_REGISTER_TRACKER(MyTracker);
45 // USING CODE:
46 //
47 // BaseTracker* tracker =
48 // BaseTrackerRegisterer::get_instance_by_name("MyTracker");
49 // using tracker to do somethings.
50 // ////////////////////////////////////////////////////
51 #pragma once
52 
53 #include <string>
54 
55 #include "Eigen/Core"
56 
57 #include "cyber/common/log.h"
58 #include "cyber/common/macros.h"
59 
63 
64 namespace apollo {
65 namespace perception {
66 namespace radar {
67 struct TrackerOptions {};
68 class BaseTracker {
69  public:
70  BaseTracker() : name_("BaseTracker") {}
71  virtual ~BaseTracker() = default;
72  virtual bool Init() = 0;
73  // @brief: tracking objects.
74  // @param [in]: current object frame.
75  // @param [in]: options.
76  // @param [out]: current tracked objects frame.
77  virtual bool Track(const base::Frame &detected_frame,
78  const TrackerOptions &options,
79  base::FramePtr tracked_frame) = 0;
80  virtual std::string Name() { return name_; }
81 
82  protected:
83  std::string name_;
84 
85  private:
87 };
89 #define PERCEPTION_REGISTER_TRACKER(name) \
90  PERCEPTION_REGISTER_CLASS(BaseTracker, name)
91 } // namespace radar
92 } // namespace perception
93 } // namespace apollo
Definition: frame.h:32
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
BaseTracker()
Definition: base_tracker.h:70
virtual std::string Name()
Definition: base_tracker.h:80
Definition: base_tracker.h:67
bool Init(const char *binary_name)
Definition: base_tracker.h:68
std::string name_
Definition: base_tracker.h:83