Apollo  v5.5.0
Open source self driving car software
object.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2019 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 
26 
27 namespace apollo {
28 namespace perception {
29 namespace benchmark {
30 
31 enum ObjectType {
32  UNKNOWN = 0,
36  BICYCLE = 4,
37  VEHICLE = 5,
39 };
40 
41 ObjectType translate_string_to_type(const std::string& str);
42 
43 unsigned int translate_type_to_index(const ObjectType& type);
44 
45 std::string translate_type_index_to_string(unsigned int index);
46 
47 std::string translate_type_to_string(ObjectType type);
48 
57 };
58 
59 enum SensorType {
62  RADAR = 2,
63  CAMERA = 3,
65 };
66 
67 SensorType translate_string_to_sensor_type(const std::string& str);
68 
69 std::string translate_sensor_type_to_string(const SensorType& type);
70 
71 struct alignas(16) Object {
72  Object();
73  // shallow copy for copy constructor and assignment
74  Object(const Object& rhs);
75  Object& operator=(const Object& rhs);
76  // deep copy
77  void clone(const Object& rhs);
78  std::string to_string() const;
79 
80  // object id per frame
81  int id = 0;
82  // point cloud of the object
84  // point cloud indices of the object
86  // polygon of the object
88  // confidence of the object
89  float confidence = 1.f;
90 
91  // oriented boundingbox information
92  // main direction
93  Eigen::Vector3d direction;
94  // the yaw angle, direction with x-axis (1, 0, 0)
95  double yaw = 0.0;
96  // the roll angle, direction with
97  double roll = 0.0;
98  // the pitch angle, direction with
99  double pitch = 0.0;
100  // ground center of the object (cx, cy, z_min)
101  Eigen::Vector3d center;
102  // size of the oriented bbox, length is the size in the main direction
103  double length = 0.0;
104  double width = 0.0;
105  double height = 0.0;
106  // truncated
107  double truncated = 0.0;
108  double occluded = 0.0;
109 
110  // Object classification type.
112  // Probability of each type, used for track type.
113  std::vector<float> type_probs;
114 
115  // Internal object classification type.
117  // Internal probability of each type, used for track type.
118  std::vector<float> internal_type_probs;
119 
120  // fg/bg flag
121  bool is_background = false;
122 
123  // tracking information
124  int track_id = 0;
125 
126  Eigen::Vector3d velocity;
127  // age of the tracked object
128  double tracking_time = 0.0;
129  double latest_tracked_time = 0.0;
130 
131  // roi flag
132  bool is_in_roi = false;
133 
134  // lane flag
135  bool is_in_main_lanes = false;
136 
137  // visible related
138  float visible_ratio = 1.f;
139  bool visible = true;
140 
141  // sensor type
143 
144  // reserve
145  std::string reserve;
146 
147  // sensor particular suplplements, default nullptr
151 
152  // jaccard index with ground truth when benchmark evaluation
153  double ji = 0.0;
154 };
155 
156 typedef std::shared_ptr<Object> ObjectPtr;
157 typedef std::shared_ptr<const Object> ObjectConstPtr;
158 
159 using SeqId = uint32_t;
160 
161 // Sensor single frame objects.
163  SensorObjects() { sensor2world_pose = Eigen::Matrix4d::Zero(); }
164 
165  std::string to_string() const;
166 
168  std::string name;
169  double timestamp = 0.0;
170  SeqId seq_num = 0;
171  std::vector<ObjectPtr> objects;
172  std::vector<std::vector<Eigen::Vector3d>> objects_box_vertices;
173  std::vector<ObjectPtr> gt_objects;
174  std::vector<std::vector<Eigen::Vector3d>> gt_objects_box_vertices;
175  Eigen::Matrix4d sensor2world_pose;
176 };
177 
178 } // namespace benchmark
179 } // namespace perception
180 } // namespace apollo
double height
Definition: object.h:105
int track_id
Definition: object.h:124
InternalObjectType internal_type
Definition: object.h:116
std::string translate_sensor_type_to_string(const SensorType &type)
SensorType
Definition: object.h:59
double truncated
Definition: object.h:107
std::shared_ptr< RadarSupplement > RadarSupplementPtr
Definition: object_supplement.h:52
float visible_ratio
Definition: object.h:138
Definition: blob.h:72
PointCloud polygon
Definition: object.h:87
ObjectType type
Definition: object.h:111
double width
Definition: object.h:104
InternalObjectType
Definition: object.h:49
Object & operator=(const Object &rhs)
double pitch
Definition: object.h:99
std::shared_ptr< CameraSupplement > CameraSupplementPtr
Definition: object_supplement.h:68
double length
Definition: object.h:103
Eigen::Vector3d velocity
Definition: object.h:126
ObjectType
Definition: object.h:31
pcl::PointCloud< Point > PointCloud
Definition: types.h:64
std::vector< std::vector< Eigen::Vector3d > > objects_box_vertices
Definition: object.h:172
SensorType translate_string_to_sensor_type(const std::string &str)
pcl::PointCloud< Point >::Ptr PointCloudPtr
Definition: types.h:65
std::vector< ObjectPtr > objects
Definition: object.h:171
CameraSupplementPtr camera_supplement
Definition: object.h:150
std::shared_ptr< Object > ObjectPtr
Definition: object.h:156
float confidence
Definition: object.h:89
ObjectType translate_string_to_type(const std::string &str)
std::string reserve
Definition: object.h:145
PointCloudPtr cloud
Definition: object.h:83
Eigen::Vector3d direction
Definition: object.h:93
std::string translate_type_to_string(ObjectType type)
unsigned int translate_type_to_index(const ObjectType &type)
std::string translate_type_index_to_string(unsigned int index)
::pcl::PointIndices::Ptr PointIndicesPtr
Definition: types.h:30
bool is_background
Definition: object.h:121
double tracking_time
Definition: object.h:128
LidarSupplementPtr lidar_supplement
Definition: object.h:148
uint32_t SeqId
Definition: object.h:159
PointIndicesPtr indices
Definition: object.h:85
bool visible
Definition: object.h:139
SensorType sensor_type
Definition: object.h:142
std::vector< float > internal_type_probs
Definition: object.h:118
double yaw
Definition: object.h:95
std::shared_ptr< LidarSupplement > LidarSupplementPtr
Definition: object_supplement.h:34
std::vector< std::vector< Eigen::Vector3d > > gt_objects_box_vertices
Definition: object.h:174
double latest_tracked_time
Definition: object.h:129
std::string name
Definition: object.h:168
bool is_in_roi
Definition: object.h:132
std::vector< ObjectPtr > gt_objects
Definition: object.h:173
std::shared_ptr< const Object > ObjectConstPtr
Definition: object.h:157
Eigen::Matrix4d sensor2world_pose
Definition: object.h:175
double occluded
Definition: object.h:108
RadarSupplementPtr radar_supplement
Definition: object.h:149
double ji
Definition: object.h:153
std::vector< float > type_probs
Definition: object.h:113
bool is_in_main_lanes
Definition: object.h:135
double roll
Definition: object.h:97
Eigen::Vector3d center
Definition: object.h:101