Apollo  6.0
Open source self driving car software
radar_track.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 #pragma once
17 
18 #include <memory>
19 #include <string>
20 
21 #include "Eigen/Core"
22 
23 #include "cyber/common/log.h"
24 #include "cyber/common/macros.h"
25 
30 
31 namespace apollo {
32 namespace perception {
33 namespace radar {
34 
35 class RadarTrack {
36  public:
37  RadarTrack(const base::ObjectPtr &obs, const double timestamp);
39  // update the object after association with a radar obervation
40  void UpdataObsRadar(const base::ObjectPtr &obs_radar, const double timestamp);
41  void SetObsRadarNullptr();
42  int GetObsId() const;
45  double GetTimestamp();
46  double GetTrackingTime();
47  bool IsDead() { return is_dead_; }
48  void SetDead() { is_dead_ = true; }
49  bool ConfirmTrack() { return tracked_times_ > s_tracked_times_threshold_; }
50  static void SetTrackedTimesThreshold(const int &threshold) {
51  s_tracked_times_threshold_ = threshold;
52  }
53  static void SetChosenFilter(const std::string &chosen_filter) {
54  s_chosen_filter_ = chosen_filter;
55  }
56  static void SetUseFilter(bool use_filter) { s_use_filter_ = use_filter; }
57 
58  private:
59  double timestamp_ = 0.0;
60  int obs_id_ = 0;
61  int tracked_times_ = 0;
62  double tracking_time_ = 0.0;
63  bool is_dead_ = false;
64  base::ObjectPtr obs_radar_ = nullptr; // observasion from radar
65  base::ObjectPtr obs_ = nullptr; // track result after tracking
66  std::shared_ptr<BaseFilter> filter_ = nullptr;
67 
68  static std::string s_chosen_filter_;
69  static int s_current_idx_;
70  static int s_tracked_times_threshold_;
71  static bool s_use_filter_;
72 
73  DISALLOW_COPY_AND_ASSIGN(RadarTrack);
74 };
75 
76 typedef std::shared_ptr<RadarTrack> RadarTrackPtr;
77 
78 } // namespace radar
79 } // namespace perception
80 } // namespace apollo
Definition: radar_track.h:35
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
~RadarTrack()
Definition: radar_track.h:38
bool ConfirmTrack()
Definition: radar_track.h:49
static void SetChosenFilter(const std::string &chosen_filter)
Definition: radar_track.h:53
void UpdataObsRadar(const base::ObjectPtr &obs_radar, const double timestamp)
std::shared_ptr< RadarTrack > RadarTrackPtr
Definition: radar_track.h:76
static void SetUseFilter(bool use_filter)
Definition: radar_track.h:56
bool IsDead()
Definition: radar_track.h:47
static void SetTrackedTimesThreshold(const int &threshold)
Definition: radar_track.h:50
RadarTrack(const base::ObjectPtr &obs, const double timestamp)
Image< uchar > * threshold(Image< T > *src, int t)
Definition: imutil.h:63
void SetDead()
Definition: radar_track.h:48
std::shared_ptr< Object > ObjectPtr
Definition: object.h:123