Apollo  6.0
Open source self driving car software
probabilistic_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 <memory>
19 #include <string>
20 #include <vector>
21 
27 
28 namespace apollo {
29 namespace perception {
30 namespace fusion {
31 
32 struct FusionParams {
33  bool use_lidar = true;
34  bool use_radar = true;
35  bool use_camera = true;
36  std::string tracker_method;
38  std::string gate_keeper_method;
39  std::vector<std::string> prohibition_sensors;
40 };
41 
43  public:
46 
48  ProbabilisticFusion& operator=(const ProbabilisticFusion&) = delete;
49 
50  bool Init(const FusionInitOptions& init_options) override;
51 
52  bool Fuse(const FusionOptions& options,
53  const base::FrameConstPtr& sensor_frame,
54  std::vector<base::ObjectPtr>* fused_objects) override;
55 
56  std::string Name() const override;
57 
58  private:
59  bool IsPublishSensor(const base::FrameConstPtr& sensor_frame) const;
60 
61  void FuseFrame(const SensorFramePtr& frame);
62 
63  void CollectFusedObjects(double timestamp,
64  std::vector<base::ObjectPtr>* fused_objects);
65 
66  void FuseForegroundTrack(const SensorFramePtr& frame);
67  void FusebackgroundTrack(const SensorFramePtr& frame);
68 
69  void RemoveLostTrack();
70 
71  void UpdateAssignedTracks(
72  const SensorFramePtr& frame,
73  const std::vector<TrackMeasurmentPair>& assignments);
74 
75  void UpdateUnassignedTracks(const SensorFramePtr& frame,
76  const std::vector<size_t>& unassigned_track_inds);
77 
78  void CreateNewTracks(const SensorFramePtr& frame,
79  const std::vector<size_t>& unassigned_obj_inds);
80 
81  void CollectObjectsByTrack(double timestamp, const TrackPtr& track,
82  std::vector<base::ObjectPtr>* fused_objects);
83 
84  void CollectSensorMeasurementFromObject(
85  const SensorObjectConstPtr& object,
86  base::SensorObjectMeasurement* measurement);
87 
88  private:
89  std::mutex data_mutex_;
90  std::mutex fuse_mutex_;
91 
92  bool started_ = false;
93 
94  ScenePtr scenes_ = nullptr;
95  std::vector<std::shared_ptr<BaseTracker>> trackers_; // for foreground
96 
97  std::unique_ptr<BaseDataAssociation> matcher_;
98  std::unique_ptr<BaseGatekeeper> gate_keeper_;
99 
100  FusionParams params_;
101 };
102 
103 } // namespace fusion
104 } // namespace perception
105 } // namespace apollo
std::string data_association_method
Definition: probabilistic_fusion.h:37
Definition: base_fusion_system.h:37
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
bool use_radar
Definition: probabilistic_fusion.h:34
std::string gate_keeper_method
Definition: probabilistic_fusion.h:38
Definition: object_supplement.h:224
Definition: base_fusion_system.h:31
bool use_camera
Definition: probabilistic_fusion.h:35
std::shared_ptr< const Frame > FrameConstPtr
Definition: frame.h:61
std::shared_ptr< Track > TrackPtr
Definition: track.h:160
Definition: probabilistic_fusion.h:32
bool use_lidar
Definition: probabilistic_fusion.h:33
std::shared_ptr< SensorFrame > SensorFramePtr
Definition: base_forward_declaration.h:28
bool Init(const char *binary_name)
Definition: probabilistic_fusion.h:42
Definition: base_fusion_system.h:35
std::vector< std::string > prohibition_sensors
Definition: probabilistic_fusion.h:39
std::string tracker_method
Definition: probabilistic_fusion.h:36
std::shared_ptr< const SensorObject > SensorObjectConstPtr
Definition: sensor_object.h:69
std::shared_ptr< Scene > ScenePtr
Definition: scene.h:58