Apollo  6.0
Open source self driving car software
hm_tracks_objects_match.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 <string>
19 #include <vector>
20 
24 
25 namespace apollo {
26 namespace perception {
27 namespace fusion {
28 
30  public:
35  delete;
36 
37  bool Init() override {
38  track_object_distance_.set_distance_thresh(
39  static_cast<float>(s_match_distance_thresh_));
40  return true;
41  }
42 
43  bool Associate(const AssociationOptions& options,
44  SensorFramePtr sensor_measurements, ScenePtr scene,
45  AssociationResult* association_result) override;
46 
47  std::string Name() const override { return "HMTrackersObjectsAssociation"; }
48 
49  private:
50  void ComputeAssociationDistanceMat(
51  const std::vector<TrackPtr>& fusion_tracks,
52  const std::vector<SensorObjectPtr>& sensor_objects,
53  const Eigen::Vector3d& ref_point,
54  const std::vector<size_t>& unassigned_tracks,
55  const std::vector<size_t>& unassigned_measurements,
56  std::vector<std::vector<double>>* association_mat);
57 
58  void IdAssign(const std::vector<TrackPtr>& fusion_tracks,
59  const std::vector<SensorObjectPtr>& sensor_objects,
60  std::vector<TrackMeasurmentPair>* assignments,
61  std::vector<size_t>* unassigned_fusion_tracks,
62  std::vector<size_t>* unassigned_sensor_objects,
63  bool do_nothing = false, bool post = false);
64 
65  void PostIdAssign(const std::vector<TrackPtr>& fusion_tracks,
66  const std::vector<SensorObjectPtr>& sensor_objects,
67  const std::vector<size_t>& unassigned_fusion_tracks,
68  const std::vector<size_t>& unassigned_sensor_objects,
69  std::vector<TrackMeasurmentPair>* post_assignments);
70 
71  bool MinimizeAssignment(
72  const std::vector<std::vector<double>>& association_mat,
73  const std::vector<size_t>& track_ind_l2g,
74  const std::vector<size_t>& measurement_ind_l2g,
75  std::vector<TrackMeasurmentPair>* assignments,
76  std::vector<size_t>* unassigned_tracks,
77  std::vector<size_t>* unassigned_measurements);
78 
79  void ComputeDistance(const std::vector<TrackPtr>& fusion_tracks,
80  const std::vector<SensorObjectPtr>& sensor_objects,
81  const std::vector<size_t>& unassigned_fusion_track,
82  const std::vector<int>& track_ind_g2l,
83  const std::vector<int>& measurement_ind_g2l,
84  const std::vector<size_t>& measurement_ind_l2g,
85  const std::vector<std::vector<double>>& association_mat,
86  AssociationResult* association_result);
87 
88  void GenerateUnassignedData(
89  size_t track_num, size_t objects_num,
90  const std::vector<TrackMeasurmentPair>& assignments,
91  std::vector<size_t>* unassigned_tracks,
92  std::vector<size_t>* unassigned_objects);
93 
94  private:
96  TrackObjectDistance track_object_distance_;
97  static double s_match_distance_thresh_;
98  static double s_match_distance_bound_;
99  static double s_association_center_dist_threshold_;
100 };
101 
102 } // namespace fusion
103 } // namespace perception
104 } // namespace apollo
~HMTrackersObjectsAssociation()
Definition: hm_tracks_objects_match.h:32
bool Init() override
Definition: hm_tracks_objects_match.h:37
std::string Name() const override
Definition: hm_tracks_objects_match.h:47
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
HMTrackersObjectsAssociation & operator=(const HMTrackersObjectsAssociation &)=delete
Definition: track_object_distance.h:42
Eigen::Vector3d Vector3d
Definition: frame_transform.h:27
Definition: base_data_association.h:43
std::shared_ptr< SensorFrame > SensorFramePtr
Definition: base_forward_declaration.h:28
Definition: base_data_association.h:31
bool Associate(const AssociationOptions &options, SensorFramePtr sensor_measurements, ScenePtr scene, AssociationResult *association_result) override
HMTrackersObjectsAssociation()
Definition: hm_tracks_objects_match.h:31
Definition: hm_tracks_objects_match.h:29
void set_distance_thresh(const float distance_thresh)
Definition: track_object_distance.h:49
Definition: base_data_association.h:35
std::shared_ptr< Scene > ScenePtr
Definition: scene.h:58