Apollo  6.0
Open source self driving car software
dst_existence_fusion.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 <map>
19 #include <string>
20 #include <vector>
21 
24 
25 namespace apollo {
26 namespace perception {
27 namespace fusion {
28 
29 struct ToicDstMaps {
30  // for (N)TOIC: (not)target of interest in camera judgement
31  enum { TOIC = (1 << 0), NTOIC = (1 << 1), TOICUNKNOWN = (TOIC | NTOIC) };
32  std::vector<uint64_t> fod_subsets_ = {TOIC, NTOIC, TOICUNKNOWN};
33  std::vector<std::string> subset_names_ = {"TOIC", "NTOIC", "TOICUNKNOWN"};
34 };
35 
37  enum { EXIST = (1 << 0), NEXIST = (1 << 1), EXISTUNKNOWN = (EXIST | NEXIST) };
38  std::vector<uint64_t> fod_subsets_ = {EXIST, NEXIST, EXISTUNKNOWN};
39  std::vector<std::string> subset_names_ = {"EXIST", "NEXIST", "EXISTUNKNOWN"};
40 };
41 
43  std::map<std::string, double> camera_max_valid_dist_ = {
44  {"camera_smartereye", 110},
45  {"camera_front_obstacle", 110},
46  {"camera_front_narrow", 150},
47  {"front_6mm", 110},
48  };
49  double track_object_max_match_distance_ = 4.0;
50 };
51 
53  public:
54  explicit DstExistenceFusion(TrackPtr track);
56 
57  // @brief: add dst application
58  static bool Init();
59 
60  // @brief: update track state with measurement
61  // @param [in]: measurement
62  // @param [in]: target_timestamp
63  void UpdateWithMeasurement(const SensorObjectPtr measurement,
64  double target_timestamp,
65  double match_dist) override;
66 
67  void UpdateWithoutMeasurement(const std::string &sensor_id,
68  double measurement_timestamp,
69  double target_timestamp,
70  double min_match_dist) override;
71 
72  std::string Name() const;
73  double GetToicScore() const { return toic_score_; }
74  double GetExistenceProbability() const;
75 
76  private:
77  void UpdateToicWithCameraMeasurement(const SensorObjectPtr &camera_obj,
78  double match_dist);
79  void UpdateToicWithoutCameraMeasurement(const std::string &sensor_id,
80  double measurement_timestamp,
81  double match_dist);
82 
83  double ComputeDistDecay(base::ObjectConstPtr obj,
84  const std::string &sensor_id, double timestamp);
85  double ComputeFeatureInfluence(const SensorObjectPtr measurement);
86  double GetExistReliability(const SensorObjectPtr measurement);
87  double GetUnexistReliability(const std::string &sensor_id);
88  double GetToicProbability() const;
89 
90  // Update state
91  void UpdateExistenceState();
92 
93  private:
94  double existence_score_ = 0.0;
95  Dst fused_toic_;
96  Dst fused_existence_;
97  double toic_score_ = 0.0;
98 
99  private:
100  static const char *name_;
101  static const char *toic_name_;
102  static ExistenceDstMaps existence_dst_maps_;
103  static ToicDstMaps toic_dst_maps_;
104  static DstExistenceFusionOptions options_;
105 };
106 
107 } // namespace fusion
108 } // namespace perception
109 } // namespace apollo
std::vector< std::string > subset_names_
Definition: dst_existence_fusion.h:33
~DstExistenceFusion()
Definition: dst_existence_fusion.h:55
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::vector< uint64_t > fod_subsets_
Definition: dst_existence_fusion.h:32
Definition: dst_existence_fusion.h:31
Definition: dst_existence_fusion.h:36
std::shared_ptr< SensorObject > SensorObjectPtr
Definition: sensor_object.h:68
Definition: base_existence_fusion.h:29
double GetToicScore() const
Definition: dst_existence_fusion.h:73
std::shared_ptr< Track > TrackPtr
Definition: track.h:160
Definition: dst_evidence.h:91
Definition: dst_existence_fusion.h:42
Definition: dst_existence_fusion.h:52
bool Init(const char *binary_name)
std::shared_ptr< const Object > ObjectConstPtr
Definition: object.h:124
Definition: dst_existence_fusion.h:29
Definition: dst_existence_fusion.h:31
Definition: dst_existence_fusion.h:31
Definition: dst_existence_fusion.h:37