Apollo 10.0
自动驾驶开放平台
apollo::perception::fusion 命名空间参考

struct  AssociationInitOptions
 
struct  AssociationOptions
 
struct  AssociationResult
 
class  BaseDataAssociation
 
class  BaseExistenceFusion
 
class  BaseFilter
 
class  BaseFusionSystem
 
class  BaseGatekeeper
 
class  BaseMotionFusion
 
class  BaseShapeFusion
 
class  BaseTracker
 
class  BaseTypeFusion
 
struct  CameraDstTypeFusionParam
 
class  Dst
 
struct  DstCommonData
 
class  DstExistenceFusion
 
struct  DstExistenceFusionOptions
 
class  DstManager
 
struct  DstMaps
 
class  DstTypeFusion
 
struct  DstTypeFusionConfig
 
struct  DstTypeFusionOptions
 
class  DummyDataAssociation
 
class  DummyFusionSystem
 
class  DummyTracker
 
struct  ExistenceDstMaps
 
struct  ExistenceFusionInitOptions
 
class  FusedObject
 
struct  FusionComponentConfig
 
struct  FusionFrame
 
struct  FusionInitOptions
 
struct  FusionParams
 
struct  GatekeeperInitOptions
 
class  HMTrackersObjectsAssociation
 
struct  HSimilarityParams
 
class  InformationFilter
 
class  KalmanFilter
 
class  KalmanMotionFusion
 
struct  LidarDstTypeFusionParam
 
struct  LocSimilarityParams
 
class  MultiSensorFusionComponent
 
class  PbfGatekeeper
 
struct  PbfGatekeeperConfig
 
struct  PbfGatekeeperParams
 
class  PbfShapeFusion
 
class  PbfTracker
 
struct  PbfTrackerConfig
 
class  ProbabilisticFusion
 
struct  ProbabilisticFusionConfig
 
class  ProjectionCache
 
class  ProjectionCacheFrame
 
class  ProjectionCacheObject
 
class  Scene
 
class  Sensor
 
class  SensorDataManager
 
class  SensorFrame
 
struct  SensorFrameHeader
 
class  SensorObject
 
struct  ToicDstMaps
 
class  Track
 
struct  TrackerInitOptions
 
struct  TrackerOptions
 
struct  TrackInitializer
 
class  TrackObjectDistance
 
struct  TrackObjectDistanceOptions
 
struct  TypeFusionInitOptions
 
struct  WSimilarityParams
 
struct  XSimilarityParams
 
struct  YSimilarityParams
 

类型定义

typedef std::shared_ptr< SensorFrameHeaderSensorFrameHeaderPtr
 
typedef std::shared_ptr< const SensorFrameHeaderSensorFrameHeaderConstPtr
 
typedef std::shared_ptr< SensorFrameSensorFramePtr
 
typedef std::shared_ptr< const SensorFrameSensorFrameConstPtr
 
typedef std::shared_ptr< SensorSensorPtr
 
typedef std::shared_ptr< const SensorSensorConstPtr
 
typedef std::shared_ptr< SceneScenePtr
 
typedef std::shared_ptr< const SceneSceneConstPtr
 
typedef std::shared_ptr< SensorObjectSensorObjectPtr
 
typedef std::shared_ptr< const SensorObjectSensorObjectConstPtr
 
typedef std::shared_ptr< FusedObjectFusedObjectPtr
 
typedef std::map< std::string, SensorObjectPtrSensorId2ObjectMap
 
typedef std::shared_ptr< TrackTrackPtr
 
typedef std::shared_ptr< const TrackTrackConstPtr
 
typedef base::ConcurrentObjectPool< Track, kTrackPoolSize, TrackInitializerTrackPool
 
typedef DstCommonDataDstCommonDataPtr
 
typedef ProjectionCacheProjectionCachePtr
 
typedef std::pair< size_t, size_t > TrackMeasurmentPair
 

函数

bool IsLidar (const SensorObjectConstPtr &obj)
 
bool IsRadar (const SensorObjectConstPtr &obj)
 
bool IsCamera (const SensorObjectConstPtr &obj)
 
 __attribute__ ((constructor)) void FusionPoolInitialize()
 
void GetObjectEightVertices (std::shared_ptr< const base::Object > obj, EigenVector< Eigen::Vector3d > *vertices)
 
bool Pt3dToCamera2d (const Eigen::Vector3d &pt3d, const Eigen::Matrix4d &world2camera_pose, base::BaseCameraModelPtr camera_model, Eigen::Vector2d *pt2d)
 
bool IsObjectEightVerticesAllBehindCamera (const std::shared_ptr< const base::Object > &obj, const Eigen::Matrix4d &world2camera_pose, base::BaseCameraModelPtr camera_model)
 
float ObjectInCameraView (SensorObjectConstPtr sensor_object, base::BaseCameraModelPtr camera_model, const Eigen::Affine3d &camera_sensor2world_pose, double camera_ts, double camera_max_dist, bool motion_compensation, bool all_in)
 
void GetObjectEightVertices (std::shared_ptr< const base::Object > obj, apollo::common::EigenVector< Eigen::Vector3d > *vertices)
 
template<typename VectorType >
bool IsPtInFrustum (const VectorType &pt, double width, double height)
 Is point lies in the frustum
 
template<typename Type >
Type CalculateAugmentedIOUBBox (const base::BBox2D< Type > &box1, const base::BBox2D< Type > &box2, const Type &augmented_buffer)
 Calculate augmented IOU BBox
 
Dst operator+ (const Dst &lhs, const Dst &rhs)
 
Dst operator* (const Dst &dst, double w)
 
double ChiSquaredCdf1TableFun (double dist)
 
double ChiSquaredCdf2TableFun (double dist)
 
template<typename T >
void extract_vector (const std::vector< T > &vec, const std::vector< size_t > &subset_inds, std::vector< T > *sub_vec)
 
double BoundedScalePositiveProbability (double p, double max_p, double min_p)
 
double ScalePositiveProbability (double p, double max_p, double th_p)
 
double WelshVarLossFun (double dist, double th, double scale)
 
double FuseTwoProbabilities (double prob1, double prob2)
 
double FuseMultipleProbabilities (const std::vector< double > &probs)
 
template<typename T >
Bound (const T &value, const T &max_value, const T &min_value)
 
double ComputePtsBoxLocationSimilarity (const ProjectionCachePtr &cache, const ProjectionCacheObject *object, const base::BBox2DF &camera_bbox)
 
double ComputePtsBoxShapeSimilarity (const ProjectionCachePtr &cache, const ProjectionCacheObject *object, const base::BBox2DF &camera_bbox)
 
double ComputePtsBoxSimilarity (const ProjectionCachePtr &cache, const ProjectionCacheObject *object, const base::BBox2DF &camera_bbox)
 
double ComputeRadarCameraXSimilarity (const double velo_ct_x, const double camera_ct_x, const double size_x, const XSimilarityParams &params)
 
double ComputeRadarCameraYSimilarity (const double velo_ct_y, const double camera_ct_y, const double size_y, const YSimilarityParams &params)
 calculate the y similarity between radar and camera
 
double ComputeRadarCameraHSimilarity (const SensorObjectConstPtr &radar, const SensorObjectConstPtr &camera, const double size_y, const EigenVector< Eigen::Vector2d > &radar_box2d_vertices, const HSimilarityParams &params)
 calculate the h similarity between radar and camera
 
double ComputeRadarCameraWSimilarity (const SensorObjectConstPtr &radar, const double width, const double size_x, const EigenVector< Eigen::Vector2d > &radar_box2d_vertices, const WSimilarityParams &params)
 calculate the w similarity between radar and camera
 
double ComputeRadarCameraLocSimilarity (const Eigen::Vector3d &radar_ct, const SensorObjectConstPtr &camera, const Eigen::Matrix4d &world2camera_pose, const LocSimilarityParams &params)
 calculate the loc similarity between radar and camera
 
double ComputeRadarCameraVelocitySimilarity (const SensorObjectConstPtr &radar, const SensorObjectConstPtr &camera)
 calculate the velocity similarity between radar and camera
 
template<typename Type >
std::string vector2string (const std::vector< Type > &values)
 
 FUSION_REGISTER_FUSIONSYSTEM (DummyFusionSystem)
 
 FUSION_REGISTER_FUSIONSYSTEM (ProbabilisticFusion)
 
 PERCEPTION_REGISTER_REGISTERER (BaseDataAssociation)
 
 PERCEPTION_REGISTER_REGISTERER (BaseFusionSystem)
 
 PERCEPTION_REGISTER_REGISTERER (BaseGatekeeper)
 
 CYBER_REGISTER_COMPONENT (MultiSensorFusionComponent)
 

变量

struct apollo::perception::fusion::SensorFrameHeader EIGEN_ALIGN16
 

类型定义说明

◆ DstCommonDataPtr

◆ FusedObjectPtr

在文件 sensor_object.h83 行定义.

◆ ProjectionCachePtr

◆ SceneConstPtr

typedef std::shared_ptr<const Scene> apollo::perception::fusion::SceneConstPtr

在文件 scene.h89 行定义.

◆ ScenePtr

typedef std::shared_ptr<Scene> apollo::perception::fusion::ScenePtr

在文件 scene.h88 行定义.

◆ SensorConstPtr

typedef std::shared_ptr<const Sensor> apollo::perception::fusion::SensorConstPtr

在文件 base_forward_declaration.h34 行定义.

◆ SensorFrameConstPtr

在文件 base_forward_declaration.h30 行定义.

◆ SensorFrameHeaderConstPtr

◆ SensorFrameHeaderPtr

◆ SensorFramePtr

在文件 base_forward_declaration.h29 行定义.

◆ SensorId2ObjectMap

在文件 track.h30 行定义.

◆ SensorObjectConstPtr

在文件 sensor_object.h68 行定义.

◆ SensorObjectPtr

在文件 sensor_object.h67 行定义.

◆ SensorPtr

在文件 base_forward_declaration.h33 行定义.

◆ TrackConstPtr

typedef std::shared_ptr<const Track> apollo::perception::fusion::TrackConstPtr

在文件 track.h398 行定义.

◆ TrackMeasurmentPair

typedef std::pair<size_t, size_t> apollo::perception::fusion::TrackMeasurmentPair

在文件 base_data_association.h37 行定义.

◆ TrackPool

◆ TrackPtr

typedef std::shared_ptr<Track> apollo::perception::fusion::TrackPtr

在文件 track.h397 行定义.

函数说明

◆ __attribute__()

apollo::perception::fusion::__attribute__ ( (constructor)  )

在文件 track_pool_types.cc25 行定义.

25 {
26 TrackPool::Instance();
27 AINFO << "Initialize FusionPool";
28}
#define AINFO
Definition log.h:42

◆ Bound()

template<typename T >
T apollo::perception::fusion::Bound ( const T &  value,
const T &  max_value,
const T &  min_value 
)

在文件 probabilities.h29 行定义.

29 {
30 return std::max(min_value, std::min(max_value, value));
31}

◆ BoundedScalePositiveProbability()

double apollo::perception::fusion::BoundedScalePositiveProbability ( double  p,
double  max_p,
double  min_p 
)

在文件 probabilities.cc28 行定义.

28 {
29 p = std::max(p, min_p);
30 p = (p - min_p) * (max_p - min_p) / (1 - min_p) + min_p;
31 return p;
32}

◆ CalculateAugmentedIOUBBox()

template<typename Type >
Type apollo::perception::fusion::CalculateAugmentedIOUBBox ( const base::BBox2D< Type > &  box1,
const base::BBox2D< Type > &  box2,
const Type &  augmented_buffer 
)

Calculate augmented IOU BBox

模板参数
Type
参数
box1
box2
augmented_buffer
返回
Type

在文件 camera_util.h66 行定义.

68 {
69 base::BBox2D<Type> augmented_box1 = box1;
70 augmented_box1.xmin -= augmented_buffer;
71 augmented_box1.ymin -= augmented_buffer;
72 augmented_box1.xmax += augmented_buffer;
73 augmented_box1.ymax += augmented_buffer;
74 base::BBox2D<Type> augmented_box2 = box2;
75 augmented_box2.xmin -= augmented_buffer;
76 augmented_box2.ymin -= augmented_buffer;
77 augmented_box2.xmax += augmented_buffer;
78 augmented_box2.ymax += augmented_buffer;
79 Type augmented_iou =
80 algorithm::CalculateIOUBBox(augmented_box1, augmented_box2);
81 return augmented_iou;
82}

◆ ChiSquaredCdf1TableFun()

double apollo::perception::fusion::ChiSquaredCdf1TableFun ( double  dist)
inline

在文件 chi_squared_cdf_1_0.0500_0.999900.h69 行定义.

69 {
70 static constexpr double step = 0.050000;
71 static const size_t table_size =
72 sizeof(ChiSquaredCdf1TableTable) / sizeof(double);
73 double dist_ind = dist / step;
74 int dist_int = static_cast<int>(dist_ind);
75 double w = dist_ind - dist_int;
76 if (dist_ind >= table_size - 1) {
77 return 1.0;
78 }
79 return (ChiSquaredCdf1TableTable[dist_int] * (1 - w) +
80 ChiSquaredCdf1TableTable[dist_int + 1] * w);
81}

◆ ChiSquaredCdf2TableFun()

double apollo::perception::fusion::ChiSquaredCdf2TableFun ( double  dist)
inline

在文件 chi_squared_cdf_2_0.0500_0.999900.h78 行定义.

78 {
79 static constexpr double step = 0.050000;
80 static const size_t table_size =
81 sizeof(ChiSquaredCdf2TableTable) / sizeof(double);
82 double dist_ind = dist / step;
83 int dist_int = static_cast<int>(dist_ind);
84 double w = dist_ind - dist_int;
85 if (dist_ind >= table_size - 1) {
86 return 1.0;
87 }
88 return (ChiSquaredCdf2TableTable[dist_int] * (1 - w) +
89 ChiSquaredCdf2TableTable[dist_int + 1] * w);
90}

◆ ComputePtsBoxLocationSimilarity()

double apollo::perception::fusion::ComputePtsBoxLocationSimilarity ( const ProjectionCachePtr cache,
const ProjectionCacheObject object,
const base::BBox2DF camera_bbox 
)

在文件 track_object_similarity.cc39 行定义.

41 {
42 static const double min_p = 1e-6;
43 static const double max_p = 1 - 1e-6;
44 double x_std_dev = 0.4;
45 double y_std_dev = 0.5;
46 size_t check_augmented_iou_minimum_pts_num = 20;
47 float augmented_buffer = 25.0f;
48 if (object->Empty()) {
49 ADEBUG << "cache object is empty!";
50 return min_p;
51 }
52 Eigen::Vector2d mean_pixel_dist(0.0, 0.0);
53 // calculate mean x y pixel distance
54 const size_t start_ind = object->GetStartInd();
55 const size_t end_ind = object->GetEndInd();
56 if (end_ind - start_ind >= check_augmented_iou_minimum_pts_num) {
57 base::BBox2DF velo_bbox = object->GetBox();
58 float augmented_iou =
59 CalculateAugmentedIOUBBox(velo_bbox, camera_bbox, augmented_buffer);
60 if (augmented_iou < kFloatEpsilon) {
61 ADEBUG << "augmented iou is empty!";
62 return min_p;
63 }
64 }
65 for (size_t i = start_ind; i < end_ind; ++i) {
66 auto* velo_pt2d = cache->GetPoint2d(i);
67 if (velo_pt2d == nullptr) {
68 AERROR << "query pt from projection cache failed!";
69 continue;
70 }
71 if (velo_pt2d->x() >= camera_bbox.xmin &&
72 velo_pt2d->x() < camera_bbox.xmax &&
73 velo_pt2d->y() >= camera_bbox.ymin &&
74 velo_pt2d->y() < camera_bbox.ymax) {
75 continue;
76 }
77 Eigen::Vector2d diff;
78 diff.x() = std::max(0.0, camera_bbox.xmin - velo_pt2d->x());
79 diff.x() = std::max(diff.x(), velo_pt2d->x() - camera_bbox.xmax);
80 diff.y() = std::max(0.0, camera_bbox.ymin - velo_pt2d->y());
81 diff.y() = std::max(diff.y(), velo_pt2d->y() - camera_bbox.ymax);
82 mean_pixel_dist += diff;
83 }
84 mean_pixel_dist /= static_cast<double>(object->Size());
85 ADEBUG << "mean_pixel_dist is: " << mean_pixel_dist;
86 // normalize according to box size
87 Eigen::Vector2d box_size = Eigen::Vector2d(
88 camera_bbox.xmax - camera_bbox.xmin, camera_bbox.ymax - camera_bbox.ymin);
89 mean_pixel_dist.array() /= box_size.array();
90 // assuming the normalized distance obeys gauss distribution
91 double square_norm_mean_pixel_dist =
92 mean_pixel_dist.x() * mean_pixel_dist.x() / x_std_dev / x_std_dev +
93 mean_pixel_dist.y() * mean_pixel_dist.y() / y_std_dev / y_std_dev;
94 // use chi-square distribution. Cauchy may be more reasonable.
95 double location_similarity =
96 1 - ChiSquaredCdf2TableFun(square_norm_mean_pixel_dist);
97 // for numerical stability
98 location_similarity = std::max(min_p, std::min(max_p, location_similarity));
99 return location_similarity;
100}
#define ADEBUG
Definition log.h:41
#define AERROR
Definition log.h:44

◆ ComputePtsBoxShapeSimilarity()

double apollo::perception::fusion::ComputePtsBoxShapeSimilarity ( const ProjectionCachePtr cache,
const ProjectionCacheObject object,
const base::BBox2DF camera_bbox 
)

在文件 track_object_similarity.cc108 行定义.

110 {
111 static const double min_p = 1e-3;
112 static const double max_p = 1 - 1e-3;
113 double x_std_dev = 0.3;
114 double y_std_dev = 0.4;
115 if (object->Empty()) {
116 return min_p;
117 }
118 // compute 2d bbox size of camera & velo
119 Eigen::Vector2d camera_box_size = Eigen::Vector2d(
120 camera_bbox.xmax - camera_bbox.xmin, camera_bbox.ymax - camera_bbox.ymin);
121 // handled one point case
122 base::BBox2DF velo_projection_bbox = object->GetBox();
123 Eigen::Vector2d velo_box_size = camera_box_size / 10;
124 velo_box_size.x() =
125 std::max(static_cast<float>(velo_box_size.x()),
126 velo_projection_bbox.xmax - velo_projection_bbox.xmin);
127 velo_box_size.y() =
128 std::max(static_cast<float>(velo_box_size.y()),
129 velo_projection_bbox.ymax - velo_projection_bbox.ymin);
130 // compute normalized box size diff
131 Eigen::Vector2d mean_box_size = (camera_box_size + velo_box_size) / 2;
132 Eigen::Vector2d box_size_diff =
133 (velo_box_size - camera_box_size).array() / mean_box_size.array();
134 // assuming the normalized distance obeys gauss distribution
135 double square_norm_box_size_diff =
136 box_size_diff.x() * box_size_diff.x() / x_std_dev / x_std_dev +
137 box_size_diff.y() * box_size_diff.y() / y_std_dev / y_std_dev;
138 ADEBUG << "camera_box_size@(" << camera_box_size(0) << ","
139 << camera_box_size(1) << "); "
140 << "velo_box_size@(" << velo_box_size.x() << "," << velo_box_size.y()
141 << "); "
142 << "box_size_diff@(" << box_size_diff.x() << "," << box_size_diff.y()
143 << "); "
144 << "square_norm_box_size_diff@" << square_norm_box_size_diff;
145 // use chi-square distribution. Cauchy may be more reasonable.
146 double shape_similarity =
147 1 - ChiSquaredCdf2TableFun(square_norm_box_size_diff);
148 // for numerical stability
149 shape_similarity = std::max(min_p, std::min(max_p, shape_similarity));
150 return shape_similarity;
151}

◆ ComputePtsBoxSimilarity()

double apollo::perception::fusion::ComputePtsBoxSimilarity ( const ProjectionCachePtr cache,
const ProjectionCacheObject object,
const base::BBox2DF camera_bbox 
)

在文件 track_object_similarity.cc158 行定义.

160 {
161 double location_similarity =
162 ComputePtsBoxLocationSimilarity(cache, object, camera_bbox);
163 double shape_similarity =
164 ComputePtsBoxShapeSimilarity(cache, object, camera_bbox);
165 double fused_similarity =
166 FuseTwoProbabilities(location_similarity, shape_similarity);
167 ADEBUG << "fused_similarity@" << fused_similarity << ", location_similarity@"
168 << location_similarity << ", shape_similarity@" << shape_similarity;
169 return fused_similarity;
170}
double ComputePtsBoxShapeSimilarity(const ProjectionCachePtr &cache, const ProjectionCacheObject *object, const base::BBox2DF &camera_bbox)
double FuseTwoProbabilities(double prob1, double prob2)
double ComputePtsBoxLocationSimilarity(const ProjectionCachePtr &cache, const ProjectionCacheObject *object, const base::BBox2DF &camera_bbox)

◆ ComputeRadarCameraHSimilarity()

double apollo::perception::fusion::ComputeRadarCameraHSimilarity ( const SensorObjectConstPtr radar,
const SensorObjectConstPtr camera,
const double  size_y,
const EigenVector< Eigen::Vector2d > &  radar_box2d_vertices,
const HSimilarityParams params 
)

calculate the h similarity between radar and camera

参数
radar
camera
size_y
radar_box2d_vertices
params
返回
double

在文件 track_object_similarity.cc209 行定义.

213 {
214 const double camera_height = camera->GetBaseObject()->size(2);
215 double height_similarity = params.initial_similarity_;
216 if (camera_height > kFloatEpsilon) {
217 double min_height_diff = std::numeric_limits<double>::max();
218 for (size_t i = 0; i < 4; ++i) {
219 double img_car_height = std::abs(radar_box2d_vertices[i + 4].y() -
220 radar_box2d_vertices[i].y());
221 min_height_diff =
222 std::min(std::abs(img_car_height - size_y), min_height_diff);
223 }
224 min_height_diff /= size_y;
225 double normalized_min_height_diff = min_height_diff * min_height_diff /
226 params.diff_std_dev_ /
227 params.diff_std_dev_;
228 height_similarity = 1 - ChiSquaredCdf1TableFun(normalized_min_height_diff);
229 height_similarity = ScalePositiveProbability(height_similarity,
231 params.scale_positive_th_p_);
232 }
233 return height_similarity;
234}

◆ ComputeRadarCameraLocSimilarity()

double apollo::perception::fusion::ComputeRadarCameraLocSimilarity ( const Eigen::Vector3d &  radar_ct,
const SensorObjectConstPtr camera,
const Eigen::Matrix4d &  world2camera_pose,
const LocSimilarityParams params 
)

calculate the loc similarity between radar and camera

参数
radar_ct
camera
world2camera_pose
params
返回
double

在文件 track_object_similarity.cc257 行定义.

260 {
261 Eigen::Vector3d camera_ct = camera->GetBaseObject()->center;
262 Eigen::Vector3d camera_ct_c =
263 (world2camera_pose * camera_ct.homogeneous()).head(3);
264 double ct_diff = (radar_ct - camera_ct).norm();
265 ct_diff = ct_diff / camera_ct_c.z();
266 double ct_similarity = WelshVarLossFun(ct_diff, params.welsh_loss_thresh_,
267 params.welsh_loss_scale_);
268 ct_similarity = ScalePositiveProbability(
269 ct_similarity, params.scale_positive_max_p_, params.scale_positive_th_p_);
270 return ct_similarity;
271}
double ScalePositiveProbability(double p, double max_p, double th_p)
double WelshVarLossFun(double dist, double th, double scale)

◆ ComputeRadarCameraVelocitySimilarity()

double apollo::perception::fusion::ComputeRadarCameraVelocitySimilarity ( const SensorObjectConstPtr radar,
const SensorObjectConstPtr camera 
)

calculate the velocity similarity between radar and camera

参数
radar
camera
返回
double

在文件 track_object_similarity.cc273 行定义.

274 {
275 Eigen::Vector3f radar_velocity = radar->GetBaseObject()->velocity;
276 Eigen::Vector3f camera_velocity = camera->GetBaseObject()->velocity;
277
278 float scalar_radar_velocity = radar_velocity.norm();
279 float scalar_camera_velocity = camera_velocity.norm();
280 if (std::max(scalar_radar_velocity, scalar_camera_velocity) > 2) {
281 float diff_velocity = (radar_velocity - camera_velocity).norm() / 2;
282 float diff_velocity_ratio =
283 diff_velocity / std::max(scalar_camera_velocity, scalar_radar_velocity);
284 const float velocity_std = 0.15f;
285 const float max_velocity_p = 0.9f;
286 const float th_velocity_p = 0.5f;
287 float velocity_score = static_cast<float>(
288 1 - ChiSquaredCdf1TableFun(diff_velocity_ratio * diff_velocity_ratio /
289 velocity_std / velocity_std));
290 velocity_score = static_cast<float>(ScalePositiveProbability(
291 velocity_score, max_velocity_p, th_velocity_p));
292 return velocity_score;
293 } else {
294 return 0.5;
295 }
296}

◆ ComputeRadarCameraWSimilarity()

double apollo::perception::fusion::ComputeRadarCameraWSimilarity ( const SensorObjectConstPtr radar,
const double  width,
const double  size_x,
const EigenVector< Eigen::Vector2d > &  radar_box2d_vertices,
const WSimilarityParams params 
)

calculate the w similarity between radar and camera

参数
radar
width
size_x
radar_box2d_vertices
params
返回
double

在文件 track_object_similarity.cc235 行定义.

238 {
239 std::vector<double> radar_box2d_xs = {
240 radar_box2d_vertices[0].x(), radar_box2d_vertices[1].x(),
241 radar_box2d_vertices[2].x(), radar_box2d_vertices[3].x()};
242 for (double& x : radar_box2d_xs) {
243 x = Bound(x, width, 0.0);
244 }
245 auto min_max_xs =
246 std::minmax_element(radar_box2d_xs.begin(), radar_box2d_xs.end());
247 double radar_box2d_width = *min_max_xs.second - *min_max_xs.first;
248 double width_diff = std::abs(radar_box2d_width - size_x) / size_x;
249 double normalized_width_diff =
250 width_diff * width_diff / params.diff_std_dev_ / params.diff_std_dev_;
251 double width_similarity = 1 - ChiSquaredCdf1TableFun(normalized_width_diff);
252 width_similarity = BoundedScalePositiveProbability(
253 width_similarity, params.bounded_scale_positive_max_p_,
255 return width_similarity;
256}

◆ ComputeRadarCameraXSimilarity()

double apollo::perception::fusion::ComputeRadarCameraXSimilarity ( const double  velo_ct_x,
const double  camera_ct_x,
const double  size_x,
const XSimilarityParams params 
)

在文件 track_object_similarity.cc177 行定义.

180 {
181 double x_diff = std::abs(velo_ct_x - camera_ct_x) / size_x;
182 double x_similarity = WelshVarLossFun(x_diff, params.welsh_loss_thresh_,
183 params.welsh_loss_scale_);
184 x_similarity = ScalePositiveProbability(
185 x_similarity, params.scale_positive_max_p_, params.scale_positive_th_p_);
186 return x_similarity;
187}

◆ ComputeRadarCameraYSimilarity()

double apollo::perception::fusion::ComputeRadarCameraYSimilarity ( const double  velo_ct_y,
const double  camera_ct_y,
const double  size_y,
const YSimilarityParams params 
)

calculate the y similarity between radar and camera

参数
velo_ct_y
camera_ct_y
size_y
params
返回
double

在文件 track_object_similarity.cc188 行定义.

191 {
192 // double y_diff =
193 // std::abs(velo_ct_y - camera_ct_y + size_y * params.smooth_factor_) /
194 // size_y;
195
196 double y_diff = std::max(std::abs(velo_ct_y - camera_ct_y) -
197 size_y * params.smooth_factor_,
198 0.0) /
199 size_y;
200
201 double normalized_y_diff =
202 y_diff * y_diff / params.diff_std_dev_ / params.diff_std_dev_;
203 double y_similarity = 1 - ChiSquaredCdf1TableFun(normalized_y_diff);
204 y_similarity = BoundedScalePositiveProbability(
205 y_similarity, params.bounded_scale_positive_max_p_,
207 return y_similarity;
208}
double BoundedScalePositiveProbability(double p, double max_p, double min_p)

◆ CYBER_REGISTER_COMPONENT()

apollo::perception::fusion::CYBER_REGISTER_COMPONENT ( MultiSensorFusionComponent  )

◆ extract_vector()

template<typename T >
void apollo::perception::fusion::extract_vector ( const std::vector< T > &  vec,
const std::vector< size_t > &  subset_inds,
std::vector< T > *  sub_vec 
)

在文件 hm_tracks_objects_match.cc37 行定义.

39 {
40 sub_vec->reserve(subset_inds.size());
41 sub_vec->clear();
42 for (auto subset_ind : subset_inds) {
43 sub_vec->push_back(vec[subset_ind]);
44 }
45}

◆ FuseMultipleProbabilities()

double apollo::perception::fusion::FuseMultipleProbabilities ( const std::vector< double > &  probs)

在文件 probabilities.cc69 行定义.

69 {
70 std::vector<double> log_odd_probs = probs;
71 auto prob_to_log_odd = [](double p) {
72 p = std::max(std::min(p, 1 - 1e-6), 1e-6);
73 return std::log(p / (1 - p));
74 };
75 auto log_odd_to_prob = [](double log_odd_p) {
76 double tmp = std::exp(log_odd_p);
77 return tmp / (tmp + 1);
78 };
79 for (auto& log_odd_prob : log_odd_probs) {
80 log_odd_prob = prob_to_log_odd(log_odd_prob);
81 }
82 double log_odd_probs_sum =
83 std::accumulate(log_odd_probs.begin(), log_odd_probs.end(), 0.0);
84 return log_odd_to_prob(log_odd_probs_sum);
85}

◆ FuseTwoProbabilities()

double apollo::perception::fusion::FuseTwoProbabilities ( double  prob1,
double  prob2 
)

在文件 probabilities.cc62 行定义.

62 {
63 double prob = (prob1 * prob2) / (2 * prob1 * prob2 + 1 - prob1 - prob2);
64 return prob;
65}

◆ FUSION_REGISTER_FUSIONSYSTEM() [1/2]

apollo::perception::fusion::FUSION_REGISTER_FUSIONSYSTEM ( DummyFusionSystem  )

◆ FUSION_REGISTER_FUSIONSYSTEM() [2/2]

apollo::perception::fusion::FUSION_REGISTER_FUSIONSYSTEM ( ProbabilisticFusion  )

◆ GetObjectEightVertices() [1/2]

void apollo::perception::fusion::GetObjectEightVertices ( std::shared_ptr< const base::Object obj,
apollo::common::EigenVector< Eigen::Vector3d > *  vertices 
)

◆ GetObjectEightVertices() [2/2]

void apollo::perception::fusion::GetObjectEightVertices ( std::shared_ptr< const base::Object obj,
EigenVector< Eigen::Vector3d > *  vertices 
)

在文件 camera_util.cc31 行定义.

32 {
33 vertices->clear();
34 vertices->resize(8);
35 Eigen::Vector3d center = obj->center;
36 Eigen::Vector2d dir = obj->direction.head(2).cast<double>();
37 dir.normalize();
38 Eigen::Vector2d orth_dir(-dir.y(), dir.x());
39 Eigen::Vector2d delta_x = dir * obj->size(0) * 0.5;
40 Eigen::Vector2d delta_y = orth_dir * obj->size(1) * 0.5;
41
42 // lower four points
43 center.z() -= obj->size(2) * 0.5;
44 (*vertices)[0] = center, (*vertices)[0].head(2) += (-delta_x - delta_y);
45 (*vertices)[1] = center, (*vertices)[1].head(2) += (-delta_x + delta_y);
46 (*vertices)[2] = center, (*vertices)[2].head(2) += (delta_x + delta_y);
47 (*vertices)[3] = center, (*vertices)[3].head(2) += (delta_x - delta_y);
48 // upper four points
49 (*vertices)[4] = (*vertices)[0], (*vertices)[4].z() += obj->size(2);
50 (*vertices)[5] = (*vertices)[1], (*vertices)[5].z() += obj->size(2);
51 (*vertices)[6] = (*vertices)[2], (*vertices)[6].z() += obj->size(2);
52 (*vertices)[7] = (*vertices)[3], (*vertices)[7].z() += obj->size(2);
53}

◆ IsCamera()

bool apollo::perception::fusion::IsCamera ( const SensorObjectConstPtr obj)

在文件 sensor_object.cc96 行定义.

96 {
97 base::SensorType type = obj->GetSensorType();
98 return algorithm::SensorManager::Instance()->IsCamera(type);
99}
SensorType
Sensor types are set in the order of lidar, radar, camera, ultrasonic Please make sure SensorType has...
Definition sensor_meta.h:29

◆ IsLidar()

bool apollo::perception::fusion::IsLidar ( const SensorObjectConstPtr obj)

在文件 sensor_object.cc86 行定义.

86 {
87 base::SensorType type = obj->GetSensorType();
88 return algorithm::SensorManager::Instance()->IsLidar(type);
89}

◆ IsObjectEightVerticesAllBehindCamera()

bool apollo::perception::fusion::IsObjectEightVerticesAllBehindCamera ( const std::shared_ptr< const base::Object > &  obj,
const Eigen::Matrix4d &  world2camera_pose,
base::BaseCameraModelPtr  camera_model 
)

在文件 camera_util.cc72 行定义.

75 {
76 EigenVector<Eigen::Vector3d> vertices(8);
77 GetObjectEightVertices(obj, &vertices);
78 Eigen::Vector2d pt2d;
79 for (const auto& vertice : vertices) {
80 if ((Pt3dToCamera2d(vertice, world2camera_pose, camera_model, &pt2d))) {
81 return false;
82 }
83 }
84 return true;
85}
bool Pt3dToCamera2d(const Eigen::Vector3d &pt3d, const Eigen::Matrix4d &world2camera_pose, base::BaseCameraModelPtr camera_model, Eigen::Vector2d *pt2d)
void GetObjectEightVertices(std::shared_ptr< const base::Object > obj, EigenVector< Eigen::Vector3d > *vertices)

◆ IsPtInFrustum()

template<typename VectorType >
bool apollo::perception::fusion::IsPtInFrustum ( const VectorType &  pt,
double  width,
double  height 
)

Is point lies in the frustum

模板参数
VectorType
参数
ptpoint
width
height
返回
true
false

在文件 camera_util.h49 行定义.

49 {
50 if (pt[0] < 0 || pt[0] > width || pt[1] < 0 || pt[1] > height) {
51 return false;
52 }
53 return true;
54}

◆ IsRadar()

bool apollo::perception::fusion::IsRadar ( const SensorObjectConstPtr obj)

在文件 sensor_object.cc91 行定义.

91 {
92 base::SensorType type = obj->GetSensorType();
93 return algorithm::SensorManager::Instance()->IsRadar(type);
94}

◆ ObjectInCameraView()

float apollo::perception::fusion::ObjectInCameraView ( SensorObjectConstPtr  sensor_object,
base::BaseCameraModelPtr  camera_model,
const Eigen::Affine3d &  camera_sensor2world_pose,
double  camera_ts,
double  camera_max_dist,
bool  motion_compensation,
bool  all_in 
)

在文件 camera_util.cc87 行定义.

91 {
92 constexpr float kFloatEpsilon = std::numeric_limits<float>::epsilon();
93 float in_view_ratio = 0.0f;
94 Eigen::Matrix4d world2sensor_pose =
95 camera_sensor2world_pose.matrix().inverse();
96 if (!world2sensor_pose.allFinite()) {
97 return in_view_ratio;
98 }
99 double width = static_cast<double>(camera_model->get_width());
100 double height = static_cast<double>(camera_model->get_height());
101
102 double time_diff =
103 camera_ts - sensor_object->GetBaseObject()->latest_tracked_time;
104 Eigen::Vector3f offset =
105 sensor_object->GetBaseObject()->velocity * static_cast<float>(time_diff);
106 if (!motion_compensation) {
107 offset.setZero();
108 }
109 // 2.compute distance
110 const auto& cloud =
111 sensor_object->GetBaseObject()->lidar_supplement.cloud_world;
112 Eigen::Vector3d center = sensor_object->GetBaseObject()->center;
113 Eigen::Vector2d center2d;
114 if (!Pt3dToCamera2d(center, world2sensor_pose, camera_model, &center2d)) {
115 return in_view_ratio;
116 }
117 double obj_length = sensor_object->GetBaseObject()->size(0);
118 double obj_width = sensor_object->GetBaseObject()->size(1);
119 double obj_height = sensor_object->GetBaseObject()->size(2);
120 if (cloud.size() > 0) {
121 // use point cloud
122 int point_num = static_cast<int>(cloud.size());
123 int in_view_point_num = 0;
124 for (int i = 0; i < point_num; ++i) {
125 const auto& pt = cloud.at(i);
126 Eigen::Vector3d pt3d(pt.x + offset[0], pt.y + offset[1],
127 pt.z + offset[2]);
128 Eigen::Vector2d pt2d;
129 bool flag = Pt3dToCamera2d(pt3d, world2sensor_pose, camera_model, &pt2d);
130 if (flag && IsPtInFrustum(pt2d, width, height)) {
131 ++in_view_point_num;
132 }
133 }
134 in_view_ratio = static_cast<float>(in_view_point_num / point_num);
135 if (all_in) {
136 in_view_ratio = (in_view_point_num == point_num) ? 1.0 : 0.0;
137 }
138 } else if (obj_width > kFloatEpsilon && obj_height > kFloatEpsilon &&
139 obj_length > kFloatEpsilon) {
140 // use object box
141 EigenVector<Eigen::Vector3d> box3d_vs(8);
142 GetObjectEightVertices(sensor_object->GetBaseObject(), &box3d_vs);
143 EigenVector<Eigen::Vector2f> box2d_vs;
144 box2d_vs.reserve(box3d_vs.size());
145 for (const auto& box3d_v : box3d_vs) {
146 Eigen::Vector2d pt2d;
147 bool flag = Pt3dToCamera2d(box3d_v + offset.cast<double>(),
148 world2sensor_pose, camera_model, &pt2d);
149 if (!flag) {
150 return in_view_ratio;
151 }
152 box2d_vs.push_back(pt2d.cast<float>());
153 }
154 Eigen::Vector2d top_left;
155 Eigen::Vector2d bottom_right;
156 top_left.setConstant(std::numeric_limits<double>::max());
157 bottom_right = -top_left;
158 for (const auto& box2d_v : box2d_vs) {
159 top_left = top_left.cwiseMin(box2d_v.cast<double>());
160 bottom_right = bottom_right.cwiseMax(box2d_v.cast<double>());
161 }
162 Eigen::Vector2d box_size = bottom_right - top_left;
163 Eigen::Vector2d bound_top_left =
164 top_left.cwiseMax(Eigen::Vector2d(0.0, 0.0));
165 Eigen::Vector2d bound_bottom_right =
166 bottom_right.cwiseMin(Eigen::Vector2d(width, height));
167 Eigen::Vector2d bound_box_size = bound_bottom_right - bound_top_left;
168 if ((bound_box_size.array() > 0.0).all()) {
169 in_view_ratio =
170 static_cast<float>(bound_box_size.prod() / box_size.prod());
171 } else {
172 in_view_ratio = 0.0;
173 }
174 if (all_in) {
175 in_view_ratio = std::abs(1.0 - in_view_ratio) <= 1e-6 ? 1.0 : 0.0;
176 }
177 } else { // use center point
178 if (!((center2d.array() > 0.0).all())) {
179 in_view_ratio = 0.0;
180 } else if (center2d.x() > width || center2d.y() > height) {
181 in_view_ratio = 0.0;
182 } else {
183 in_view_ratio = 1.0;
184 }
185 }
186 // compute distance score, when object is too far from camera
187 // the camera is hard to detect object
188 // maximum camera detection distance parameters
189 const double max_dist = camera_max_dist;
190 // 1 nearly 2m buffer
191 const double dist_slope = 0.25;
192 auto sigmoid_like_fun = [max_dist, dist_slope](double obj_dist) {
193 double x = obj_dist - max_dist;
194 return 0.5 - 0.5 * x * dist_slope /
195 std::sqrt(1 + x * x * dist_slope * dist_slope);
196 };
197 Eigen::Vector4d center3d_local = world2sensor_pose * center.homogeneous();
198 double dist_to_camera = center3d_local.z();
199 return static_cast<float>(in_view_ratio * sigmoid_like_fun(dist_to_camera));
200}
constexpr float kFloatEpsilon
Definition lane_object.h:32

◆ operator*()

Dst apollo::perception::fusion::operator* ( const Dst dst,
double  w 
)
参数
dst_evidence
w
返回
Dst

在文件 dst_evidence.cc396 行定义.

396 {
397 dst.SelfCheck();
398 Dst res(dst.app_name_);
399 // check w
400 if (w < 0.0 || w > 1.0) {
401 AERROR << boost::format(
402 "the weight of bba %lf is not valid, return default bba") %
403 w;
404 return res;
405 }
406 size_t fod_loc = dst.dst_data_ptr_->fod_loc_;
407 std::vector<double> &resbba_vec_ = res.bba_vec_;
408 const std::vector<double> &bba_vec = dst.bba_vec_;
409 for (size_t i = 0; i < resbba_vec_.size(); ++i) {
410 if (i == fod_loc) {
411 resbba_vec_[i] = 1.0 - w + w * bba_vec[i];
412 } else {
413 resbba_vec_[i] = w * bba_vec[i];
414 }
415 }
416 return res;
417}

◆ operator+()

Dst apollo::perception::fusion::operator+ ( const Dst lhs,
const Dst rhs 
)
参数
lhs
rhs
返回
Dst

在文件 dst_evidence.cc370 行定义.

370 {
371 CHECK_EQ(lhs.app_name_, rhs.app_name_)
372 << boost::format("lhs Dst(%s) is not equal to rhs Dst(%s)") %
373 lhs.app_name_ % rhs.app_name_;
374 lhs.SelfCheck();
375 rhs.SelfCheck();
376 Dst res(lhs.app_name_);
377 std::vector<double> &resbba_vec_ = res.bba_vec_;
378 const auto &combination_relations = lhs.dst_data_ptr_->combination_relations_;
379 for (size_t i = 0; i < resbba_vec_.size(); ++i) {
380 const auto &combination_pairs = combination_relations[i];
381 // AINFO << "pairs size: " << combination_pairs.size();
382 double &belief_mass = resbba_vec_[i];
383 belief_mass = 0.0;
384 for (auto combination_pair : combination_pairs) {
385 // AINFO << boost::format("(%d %d)") % combination_pair.first
386 // % combination_pair.second;
387 belief_mass += lhs.GetIndBfmass(combination_pair.first) *
388 rhs.GetIndBfmass(combination_pair.second);
389 }
390 // AINFO << boost::format("belief_mass: %lf") % belief_mass;
391 }
392 res.Normalize();
393 return res;
394}
double GetIndBfmass(size_t ind) const
Get the Ind Bfmass object
std::vector< std::vector< std::pair< size_t, size_t > > > combination_relations_

◆ PERCEPTION_REGISTER_REGISTERER() [1/3]

apollo::perception::fusion::PERCEPTION_REGISTER_REGISTERER ( BaseDataAssociation  )

◆ PERCEPTION_REGISTER_REGISTERER() [2/3]

apollo::perception::fusion::PERCEPTION_REGISTER_REGISTERER ( BaseFusionSystem  )

◆ PERCEPTION_REGISTER_REGISTERER() [3/3]

apollo::perception::fusion::PERCEPTION_REGISTER_REGISTERER ( BaseGatekeeper  )

◆ Pt3dToCamera2d()

bool apollo::perception::fusion::Pt3dToCamera2d ( const Eigen::Vector3d &  pt3d,
const Eigen::Matrix4d &  world2camera_pose,
base::BaseCameraModelPtr  camera_model,
Eigen::Vector2d *  pt2d 
)

在文件 camera_util.cc55 行定义.

58 {
59 Eigen::Vector4d local_pt = static_cast<Eigen::Matrix<double, 4, 1, 0, 4, 1>>(
60 world2camera_pose * Eigen::Vector4d(pt3d(0), pt3d(1), pt3d(2), 1));
61 if (local_pt[2] > 0) {
62 *pt2d =
63 (camera_model->Project(Eigen::Vector3f(
64 static_cast<float>(local_pt[0]), static_cast<float>(local_pt[1]),
65 static_cast<float>(local_pt[2]))))
66 .cast<double>();
67 return true;
68 }
69 return false;
70}

◆ ScalePositiveProbability()

double apollo::perception::fusion::ScalePositiveProbability ( double  p,
double  max_p,
double  th_p 
)

在文件 probabilities.cc36 行定义.

36 {
37 if (p <= th_p) {
38 return p;
39 }
40 p = (p - th_p) * (max_p - th_p) / (1 - th_p) + th_p;
41 return p;
42}

◆ vector2string()

template<typename Type >
std::string apollo::perception::fusion::vector2string ( const std::vector< Type > &  values)

在文件 dst_type_fusion.cc41 行定义.

41 {
42 return absl::StrCat("(", absl::StrJoin(values, " "), ")");
43}

◆ WelshVarLossFun()

double apollo::perception::fusion::WelshVarLossFun ( double  dist,
double  th,
double  scale 
)

在文件 probabilities.cc46 行定义.

46 {
47 double p = 1e-6;
48 if (dist < th) {
49 p = 1 - 1e-6;
50 } else {
51 dist -= th;
52 dist /= scale;
53 p = std::exp(-dist * dist);
54 }
55 return p;
56}

变量说明

◆ EIGEN_ALIGN16

struct apollo::perception::fusion::SensorFrameHeader apollo::perception::fusion::EIGEN_ALIGN16