Apollo  6.0
Open source self driving car software
tracked_object.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 
22 #include "Eigen/Core"
23 
27 
28 namespace apollo {
29 namespace perception {
30 namespace lidar {
31 
32 struct TrackedObject {
33  TrackedObject() = default;
34  TrackedObject(base::ObjectPtr obj_ptr, const Eigen::Affine3d& pose);
35  TrackedObject(const TrackedObject& rhs) = default;
36  TrackedObject& operator=(const TrackedObject& rhs) = default;
37 
38  void Reset();
39 
40  void Reset(
41  base::ObjectPtr obj_ptr, const Eigen::Affine3d& pose,
42  const Eigen::Vector3d& global_to_local_offset = Eigen::Vector3d::Zero(),
43  const base::SensorInfo& sensor = base::SensorInfo());
44 
45  std::string ToString() const;
46  void ComputeShapeFeatures();
47 
48  void AttachObject(
49  base::ObjectPtr obj_ptr, const Eigen::Affine3d& pose,
50  const Eigen::Vector3d& global_to_local_offset = Eigen::Vector3d::Zero(),
51  const base::SensorInfo& sensor = base::SensorInfo());
52 
54 
55  void CopyFrom(std::shared_ptr<TrackedObject> rhs, bool is_deep);
56 
57  void ToObject(base::ObjectPtr obj_ptr) const;
58 
59  float GetVelThreshold(base::ObjectPtr obj) const;
60  // ***************************************************
61  // self information from match
62  // ***************************************************
63  std::vector<float> shape_features;
64  std::vector<float> shape_features_full;
65  size_t histogram_bin_size = 10;
66  // association distance
67  // range from 0 to max_match_distance
68  float association_score = 0.0f;
69 
70  // ***************************************************
71  // self information from track
72  // ***************************************************
73  bool is_fake = false;
74  int track_id = -1;
75  double tracking_time = 0.0;
76 
77  // ***************************************************
78  // information from main car
79  // ***************************************************
81 
82  // ***************************************************
83  // measurement correlative information from object_ptr
84  // ***************************************************
86  // corners always store follow const order based on object direction
91 
92  // oriented
96 
98  bool is_background = false;
99 
100  // ***************************************************
101  // measurement correlative information from measurement computer
102  // ***************************************************
107 
108  // ***************************************************
109  // filter correlative information
110  // ***************************************************
111  // states
113  bool valid = false;
114  bool converged = true;
116  double update_quality = 0.0;
123 
124  // filter covariances
127 
128  // combine velocity and acceleration
129  Eigen::Vector4d state;
132 
133  // motion score (calculated in kalman_filter)
134  // the three scores are
135  // (smaller score means high probability of motion state):
136  // 1. average value of (variance of velocity norm / average velocity norm)
137  // 2. average value of abs(theta diff)
138  // 3. variance of score1
140 
141  // ***************************************************
142  // postprocess correlative information
143  // ***************************************************
150 
152 
153  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
154 } EIGEN_ALIGN16; // struct TrackedObject
155 
156 typedef std::shared_ptr<TrackedObject> TrackedObjectPtr;
157 typedef std::shared_ptr<const TrackedObject> TrackedObjectConstPtr;
158 
159 } // namespace lidar
160 } // namespace perception
161 } // namespace apollo
Eigen::Matrix4d measurement_covariance
Definition: tracked_object.h:130
Eigen::Vector3d measured_nearest_corner_velocity
Definition: tracked_object.h:105
Eigen::Vector3d center
Definition: tracked_object.h:88
Eigen::Vector3d output_velocity
Definition: tracked_object.h:144
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
TrackedObject & operator=(const TrackedObject &rhs)=default
bool is_background
Definition: tracked_object.h:98
double tracking_time
Definition: tracked_object.h:75
Eigen::Vector3d Vector3d
Definition: frame_transform.h:27
void CopyFrom(std::shared_ptr< TrackedObject > rhs, bool is_deep)
Eigen::Matrix4d Matrix4d
Definition: base_map_fwd.h:32
Eigen::Matrix4d state_covariance
Definition: tracked_object.h:131
Eigen::Vector3d motion_score
Definition: tracked_object.h:139
Eigen::Vector3d corners[4]
Definition: tracked_object.h:87
struct apollo::perception::lidar::PCLPointXYZIT EIGEN_ALIGN16
Eigen::Vector3d belief_velocity_gain
Definition: tracked_object.h:122
Eigen::Vector3d direction
Definition: tracked_object.h:93
std::vector< float > shape_features_full
Definition: tracked_object.h:64
Eigen::Vector3d global_local_offset
Definition: tracked_object.h:151
Eigen::Vector3d belief_anchor_point
Definition: tracked_object.h:119
int boostup_need_history_size
Definition: tracked_object.h:112
void AttachObject(base::ObjectPtr obj_ptr, const Eigen::Affine3d &pose, const Eigen::Vector3d &global_to_local_offset=Eigen::Vector3d::Zero(), const base::SensorInfo &sensor=base::SensorInfo())
bool converged
Definition: tracked_object.h:114
base::ObjectType type
Definition: tracked_object.h:97
int track_id
Definition: tracked_object.h:74
size_t histogram_bin_size
Definition: tracked_object.h:65
std::vector< float > shape_features
Definition: tracked_object.h:63
float convergence_confidence
Definition: tracked_object.h:115
Eigen::Matrix3d velocity_covariance
Definition: tracked_object.h:125
Eigen::Matrix3d belief_velocity_online_covariance
Definition: tracked_object.h:126
Eigen::Vector4d state
Definition: tracked_object.h:129
Eigen::Vector3d lane_direction
Definition: tracked_object.h:94
Eigen::Vector3d output_size
Definition: tracked_object.h:148
Eigen::Vector3d size
Definition: tracked_object.h:95
Eigen::Matrix3d output_velocity_uncertainty
Definition: tracked_object.h:145
Eigen::Vector3d selected_measured_velocity
Definition: tracked_object.h:117
Definition: tracked_object.h:32
Definition: sensor_meta.h:57
bool valid
Definition: tracked_object.h:113
void ToObject(base::ObjectPtr obj_ptr) const
std::shared_ptr< const TrackedObject > TrackedObjectConstPtr
Definition: tracked_object.h:157
Eigen::Vector3d measured_center_velocity
Definition: tracked_object.h:104
Eigen::Affine3d sensor_to_local_pose
Definition: tracked_object.h:80
Eigen::Vector3d belief_acceleration
Definition: tracked_object.h:121
float association_score
Definition: tracked_object.h:68
Eigen::Vector3d anchor_point
Definition: tracked_object.h:90
Eigen::Vector3d output_direction
Definition: tracked_object.h:146
ObjectType
Definition: object_types.h:26
base::SensorInfo sensor_info
Definition: tracked_object.h:149
Eigen::Vector3d selected_measured_acceleration
Definition: tracked_object.h:118
Eigen::Affine3d Affine3d
Definition: base_map_fwd.h:34
double update_quality
Definition: tracked_object.h:116
std::shared_ptr< TrackedObject > TrackedObjectPtr
Definition: tracked_object.h:156
Eigen::Vector3d measured_corners_velocity[4]
Definition: tracked_object.h:106
Eigen::Matrix3d Matrix3d
Definition: base_map_fwd.h:33
Eigen::Vector3d measured_barycenter_velocity
Definition: tracked_object.h:103
Eigen::Vector3d output_center
Definition: tracked_object.h:147
base::ObjectPtr object_ptr
Definition: tracked_object.h:85
std::shared_ptr< Object > ObjectPtr
Definition: object.h:123
Eigen::Vector3d barycenter
Definition: tracked_object.h:89
bool is_fake
Definition: tracked_object.h:73
Eigen::Vector3d belief_velocity
Definition: tracked_object.h:120
float GetVelThreshold(base::ObjectPtr obj) const