Apollo 11.0
自动驾驶开放平台
tracked_object.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2023 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
28namespace apollo {
29namespace perception {
30namespace radar4d {
31
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;
41 void Reset();
50 void Reset(
51 base::ObjectPtr obj_ptr, const Eigen::Affine3d& pose,
52 const Eigen::Vector3d& global_to_local_offset = Eigen::Vector3d::Zero(),
53 const base::SensorInfo& sensor = base::SensorInfo());
54
60 std::string ToString() const;
61
67
76 void AttachObject(
77 base::ObjectPtr obj_ptr, const Eigen::Affine3d& pose,
78 const Eigen::Vector3d& global_to_local_offset = Eigen::Vector3d::Zero(),
79 const base::SensorInfo& sensor = base::SensorInfo());
80
86
93 void CopyFrom(std::shared_ptr<TrackedObject> rhs, bool is_deep);
94
100 void ToObject(base::ObjectPtr obj_ptr) const;
101
108 float GetVelThreshold(base::ObjectPtr obj) const;
109 // ***************************************************
110 // self information from match
111 // ***************************************************
112 std::vector<float> shape_features;
113 std::vector<float> shape_features_full;
115 // association distance
116 // range from 0 to max_match_distance
117 float association_score = 0.0f;
118
119 // ***************************************************
120 // self information from track
121 // ***************************************************
122 bool is_fake = false;
123 int track_id = -1;
124 double tracking_time = 0.0;
125
126 // ***************************************************
127 // information from main car
128 // ***************************************************
129 Eigen::Affine3d sensor_to_local_pose;
130
131 // ***************************************************
132 // measurement correlative information from object_ptr
133 // ***************************************************
135 // corners always store follow const order based on object direction
136 Eigen::Vector3d corners[4];
137 Eigen::Vector3d center;
138 Eigen::Vector3d barycenter;
139 Eigen::Vector3d anchor_point;
140
141 // oriented
142 Eigen::Vector3d direction;
143 Eigen::Vector3d lane_direction;
144 Eigen::Vector3d size;
145
147 bool is_background = false;
148
149 // ***************************************************
150 // measurement correlative information from measurement computer
151 // ***************************************************
154 Eigen::Vector3d measured_nearest_corner_velocity; // no projection
155 Eigen::Vector3d measured_corners_velocity[4];
156
157 // ***************************************************
158 // filter correlative information
159 // ***************************************************
160 // states
162 bool valid = false;
163 bool converged = true;
165 double update_quality = 0.0;
168 Eigen::Vector3d belief_anchor_point;
169 Eigen::Vector3d belief_velocity;
170 Eigen::Vector3d belief_acceleration;
171 Eigen::Vector3d belief_velocity_gain;
172
173 // filter covariances
174 Eigen::Matrix3d velocity_covariance;
176
177 // combine velocity and acceleration
178 Eigen::Vector4d state;
179 Eigen::Matrix4d measurement_covariance;
180 Eigen::Matrix4d state_covariance;
181
182 // motion score (calculated in kalman_filter)
183 // the three scores are
184 // (smaller score means high probability of motion state):
185 // 1. average value of (variance of velocity norm / average velocity norm)
186 // 2. average value of abs(theta diff)
187 // 3. variance of score1
188 Eigen::Vector3d motion_score;
189
190 // ***************************************************
191 // postprocess correlative information
192 // ***************************************************
193 Eigen::Vector3d output_velocity;
195 Eigen::Vector3d output_direction;
196 Eigen::Vector3d output_center;
197 Eigen::Vector3d output_size;
199
200 Eigen::Vector3d global_local_offset;
201
202 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
203} EIGEN_ALIGN16; // struct TrackedObject
204
205typedef std::shared_ptr<TrackedObject> TrackedObjectPtr;
206typedef std::shared_ptr<const TrackedObject> TrackedObjectConstPtr;
207
208} // namespace radar4d
209} // namespace perception
210} // namespace apollo
std::shared_ptr< Object > ObjectPtr
Definition object.h:127
std::shared_ptr< const TrackedObject > TrackedObjectConstPtr
std::shared_ptr< TrackedObject > TrackedObjectPtr
struct apollo::perception::radar4d::TrackedObject EIGEN_ALIGN16
class register implement
Definition arena_queue.h:37
float GetVelThreshold(base::ObjectPtr obj) const
Get vehicle threshold
void ToObject(base::ObjectPtr obj_ptr) const
Convert tracked object to base object
TrackedObject(const TrackedObject &rhs)=default
void TransformObjectCloudToWorld()
Transform object cloud to world
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())
Attach object
void CopyFrom(std::shared_ptr< TrackedObject > rhs, bool is_deep)
Copy from tracked object
TrackedObject & operator=(const TrackedObject &rhs)=default
void ComputeShapeFeatures()
Compute shape features
std::string ToString() const
Transform tracked data state to string