Apollo  6.0
Open source self driving car software
fusion.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2020 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 
17 #pragma once
18 
19 #include <unistd.h>
20 
21 #include <algorithm>
22 #include <cmath>
23 #include <cstdlib>
24 #include <iostream>
25 #include <string>
26 #include <vector>
27 
28 #include <Eigen/Core>
29 
33 
34 namespace apollo {
35 namespace v2x {
36 namespace ft {
37 
38 class Fusion {
39  public:
40  Fusion();
41  ~Fusion() {}
42  bool Proc(const std::vector<std::vector<base::Object>> &input_objectlists,
43  double timestamp);
44  bool Init();
45  std::vector<base::Object> &get_fused_objects() { return updated_objects_; }
46  std::vector<std::vector<base::Object>> &get_fusion_result() {
47  return fusion_result_;
48  }
49  bool CombineNewResource(
50  const std::vector<base::Object> &new_objects,
51  std::vector<base::Object> *fused_objects,
52  std::vector<std::vector<base::Object>> *fusion_result);
54  const std::vector<std::vector<base::Object>> &fusion_result,
55  std::vector<base::Object> *fused_objects);
56  int DeleteRedundant(std::vector<base::Object> *objects);
57 
58  private:
59  bool CombineNewResource(const std::vector<base::Object> &new_objects);
60  bool ComputeAssociateMatrix(const std::vector<base::Object> &in1_objects,
61  const std::vector<base::Object> &in2_objects,
62  Eigen::MatrixXf *association_mat);
63  double CheckOdistance(const base::Object &in1_ptr,
64  const base::Object &in2_ptr);
65  bool CheckDisScore(const base::Object &in1_ptr, const base::Object &in2_ptr,
66  double *score);
67  bool CheckTypeScore(const base::Object &in1_ptr, const base::Object &in2_ptr,
68  double *score);
69  bool host_vehicle_ = false;
70  bool zom_vehicle_ = false;
71  double last_timestamp_;
72  const double MAX_SCORE = 250000;
73  float m_matched_dis_limit_;
74  FTConfigManager *ft_config_manager_ptr_;
75  KMkernal km_matcher_;
76  fusion::ScoreParams score_params_;
77  std::vector<std::vector<base::Object>> fusion_result_;
78  std::vector<base::Object> updated_objects_;
79 };
80 
81 } // namespace ft
82 } // namespace v2x
83 } // namespace apollo
Definition: fusion.h:38
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Definition: v2x_object.h:126
std::vector< base::Object > & get_fused_objects()
Definition: fusion.h:45
int DeleteRedundant(std::vector< base::Object > *objects)
std::vector< std::vector< base::Object > > & get_fusion_result()
Definition: fusion.h:46
bool GetV2xFusionObjects(const std::vector< std::vector< base::Object >> &fusion_result, std::vector< base::Object > *fused_objects)
~Fusion()
Definition: fusion.h:41
bool CombineNewResource(const std::vector< base::Object > &new_objects, std::vector< base::Object > *fused_objects, std::vector< std::vector< base::Object >> *fusion_result)
Definition: km.h:38
Definition: ft_config_manager.h:49
bool Proc(const std::vector< std::vector< base::Object >> &input_objectlists, double timestamp)