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

apollo::third_party_perception 更多...

命名空间

namespace  conversion_mobileye
 apollo::third_party_perception
 
namespace  conversion_radar
 apollo::third_party_perception
 
namespace  conversion_smartereye
 apollo::third_party_perception
 
namespace  filter
 apollo::third_party_perception
 
namespace  fusion
 apollo::third_party_perception
 

struct  RadarObstacle
 
struct  RadarObstacles
 
class  ThirdPartyPerception
 
class  ThirdPartyPerceptionComponent
 
struct  ThirdPartyPerceptionDevice
 
class  ThirdPartyPerceptionMobileye
 
class  ThirdPartyPerceptionSmartereye
 
class  ThirdPartyPerceptionTestBase
 

类型定义

using Point = apollo::common::Point3D
 

枚举

enum  ThirdPartyPerceptionDeviceType { SMARTEREYE = 0 , MOBILEYE = 1 }
 

函数

double GetAngleFromQuaternion (const Quaternion quaternion)
 
void FillPerceptionPolygon (PerceptionObstacle *const perception_obstacle, const double mid_x, const double mid_y, const double mid_z, const double length, const double width, const double height, const double heading)
 
double GetDefaultObjectLength (const int object_type)
 
double GetDefaultObjectWidth (const int object_type)
 
Point SLtoXY (const Point &point, const double theta)
 
Point SLtoXY (const double x, const double y, const double theta)
 
double Distance (const Point &point1, const Point &point2)
 
double GetNearestLaneHeading (const PointENU &point_enu)
 
double GetNearestLaneHeading (const Point &point)
 
double GetNearestLaneHeading (const double x, const double y, const double z)
 
double GetLateralDistanceToNearestLane (const Point &point)
 
double Speed (const Point &point)
 
double Speed (const double vx, const double vy)
 
double HeadingDifference (const double theta1, const double theta2)
 

详细描述

类型定义说明

◆ Point

枚举类型说明

◆ ThirdPartyPerceptionDeviceType

函数说明

◆ Distance()

double apollo::third_party_perception::Distance ( const Point point1,
const Point point2 
)

在文件 third_party_perception_util.cc134 行定义.

134 {
135 double distance =
136 std::sqrt((point1.x() - point2.x()) * (point1.x() - point2.x()) +
137 (point1.y() - point2.y()) * (point1.y() - point2.y()));
138 return distance;
139}

◆ FillPerceptionPolygon()

void apollo::third_party_perception::FillPerceptionPolygon ( PerceptionObstacle *const  perception_obstacle,
const double  mid_x,
const double  mid_y,
const double  mid_z,
const double  length,
const double  width,
const double  height,
const double  heading 
)

在文件 third_party_perception_util.cc48 行定义.

52 {
53 // Generate a 2D cube whose vertices are given in counter-clock order when
54 // viewed from top
55 const int sign_l[4] = {1, 1, -1, -1};
56 const int sign_w[4] = {1, -1, -1, 1};
57 for (int i = 0; i < 4; ++i) {
58 perception_obstacle->add_polygon_point();
59 perception_obstacle->mutable_polygon_point(i)->set_x(
60 mid_x + sign_l[i] * length * std::cos(heading) / 2.0 +
61 sign_w[i] * width * std::sin(heading) / 2.0);
62 perception_obstacle->mutable_polygon_point(i)->set_y(
63 mid_y + sign_l[i] * length * std::sin(heading) / 2.0 -
64 sign_w[i] * width * std::cos(heading) / 2.0);
65 perception_obstacle->mutable_polygon_point(i)->set_z(mid_z);
66 }
67}

◆ GetAngleFromQuaternion()

double apollo::third_party_perception::GetAngleFromQuaternion ( const Quaternion  quaternion)

在文件 third_party_perception_util.cc39 行定义.

39 {
40 double theta = std::atan2(2.0 * (quaternion.qw() * quaternion.qz() +
41 quaternion.qx() * quaternion.qy()),
42 1.0 - 2.0 * (quaternion.qy() * quaternion.qy() +
43 quaternion.qz() * quaternion.qz())) +
44 std::acos(-1.0) / 2.0;
45 return theta;
46}

◆ GetDefaultObjectLength()

double apollo::third_party_perception::GetDefaultObjectLength ( const int  object_type)

在文件 third_party_perception_util.cc69 行定义.

69 {
70 double default_object_length = 0.0;
71 switch (object_type) {
72 case 0: {
73 default_object_length = FLAGS_default_car_length;
74 break;
75 }
76 case 1: {
77 default_object_length = FLAGS_default_truck_length;
78 break;
79 }
80 case 2: {
81 default_object_length = FLAGS_default_bike_length;
82 break;
83 }
84 case 3: {
85 default_object_length = FLAGS_default_ped_length;
86 break;
87 }
88 case 4: {
89 default_object_length = FLAGS_default_unknown_length;
90 break;
91 }
92 }
93 return default_object_length;
94}

◆ GetDefaultObjectWidth()

double apollo::third_party_perception::GetDefaultObjectWidth ( const int  object_type)

在文件 third_party_perception_util.cc96 行定义.

96 {
97 double default_object_width = 0.0;
98 switch (object_type) {
99 case 0: {
100 default_object_width = FLAGS_default_car_width;
101 break;
102 }
103 case 1: {
104 default_object_width = FLAGS_default_truck_width;
105 break;
106 }
107 case 2: {
108 default_object_width = FLAGS_default_bike_width;
109 break;
110 }
111 case 3: {
112 default_object_width = FLAGS_default_ped_width;
113 break;
114 }
115 case 4: {
116 default_object_width = FLAGS_default_unknown_width;
117 break;
118 }
119 }
120 return default_object_width;
121}

◆ GetLateralDistanceToNearestLane()

double apollo::third_party_perception::GetLateralDistanceToNearestLane ( const Point point)

在文件 third_party_perception_util.cc197 行定义.

197 {
198 auto* hdmap = HDMapUtil::BaseMapPtr();
199 if (hdmap == nullptr) {
200 AERROR << "Failed to get nearest lane for point " << point.DebugString();
201 return -1.0;
202 }
203
204 PointENU point_enu;
205 point_enu.set_x(point.x());
206 point_enu.set_y(point.y());
207 point_enu.set_z(point.z());
208 hdmap::LaneInfoConstPtr nearest_lane;
209
210 double nearest_s;
211 double nearest_l;
212
213 int status =
214 hdmap->GetNearestLane(point_enu, &nearest_lane, &nearest_s, &nearest_l);
215 // TODO(lizh): make it a formal status below
216 if (status != 0) {
217 AERROR << "Failed to get nearest lane for point " << point.DebugString();
218 return -1.0;
219 }
220 AINFO << "Dist: " << nearest_l;
221 return nearest_l;
222}
#define AERROR
Definition log.h:44
#define AINFO
Definition log.h:42
std::shared_ptr< const LaneInfo > LaneInfoConstPtr

◆ GetNearestLaneHeading() [1/3]

double apollo::third_party_perception::GetNearestLaneHeading ( const double  x,
const double  y,
const double  z 
)

在文件 third_party_perception_util.cc181 行定义.

181 {
182 auto* hdmap = HDMapUtil::BaseMapPtr();
183 if (hdmap == nullptr) {
184 AERROR << "Failed to get nearest lane for point (" << x << ", " << y << ", "
185 << z << ")";
186 return -1.0;
187 }
188
189 PointENU point_enu;
190 point_enu.set_x(x);
191 point_enu.set_y(y);
192 point_enu.set_z(z);
193
194 return GetNearestLaneHeading(point_enu);
195}

◆ GetNearestLaneHeading() [2/3]

double apollo::third_party_perception::GetNearestLaneHeading ( const Point point)

在文件 third_party_perception_util.cc166 行定义.

166 {
167 auto* hdmap = HDMapUtil::BaseMapPtr();
168 if (hdmap == nullptr) {
169 AERROR << "Failed to get nearest lane for point " << point.DebugString();
170 return -1.0;
171 }
172
173 PointENU point_enu;
174 point_enu.set_x(point.x());
175 point_enu.set_y(point.y());
176 point_enu.set_z(point.z());
177
178 return GetNearestLaneHeading(point_enu);
179}

◆ GetNearestLaneHeading() [3/3]

double apollo::third_party_perception::GetNearestLaneHeading ( const PointENU point_enu)

在文件 third_party_perception_util.cc141 行定义.

141 {
142 auto* hdmap = HDMapUtil::BaseMapPtr();
143 if (hdmap == nullptr) {
144 AERROR << "Failed to get nearest lane for point "
145 << point_enu.DebugString();
146 return -1.0;
147 }
148
149 hdmap::LaneInfoConstPtr nearest_lane;
150
151 double nearest_s;
152 double nearest_l;
153
154 int status =
155 hdmap->GetNearestLane(point_enu, &nearest_lane, &nearest_s, &nearest_l);
156 // TODO(lizh): make it a formal status below
157 if (status != 0) {
158 AERROR << "Failed to get nearest lane for point "
159 << point_enu.DebugString();
160 return -1.0;
161 }
162 double lane_heading = nearest_lane->Heading(nearest_s);
163 return lane_heading;
164}

◆ HeadingDifference()

double apollo::third_party_perception::HeadingDifference ( const double  theta1,
const double  theta2 
)

在文件 third_party_perception_util.cc232 行定义.

232 {
233 double theta_diff = std::abs(theta1 - theta2);
234 return theta_diff > M_PI ? (2 * M_PI - theta_diff) : theta_diff;
235}

◆ SLtoXY() [1/2]

apollo::common::Point3D apollo::third_party_perception::SLtoXY ( const double  x,
const double  y,
const double  theta 
)

在文件 third_party_perception_util.cc127 行定义.

127 {
128 Point converted_point;
129 converted_point.set_x(x * std::cos(theta) + y * std::sin(theta));
130 converted_point.set_y(x * std::sin(theta) - y * std::cos(theta));
131 return converted_point;
132}

◆ SLtoXY() [2/2]

apollo::common::Point3D apollo::third_party_perception::SLtoXY ( const Point point,
const double  theta 
)

在文件 third_party_perception_util.cc123 行定义.

123 {
124 return SLtoXY(point.x(), point.y(), theta);
125}
Point SLtoXY(const Point &point, const double theta)

◆ Speed() [1/2]

double apollo::third_party_perception::Speed ( const double  vx,
const double  vy 
)

在文件 third_party_perception_util.cc228 行定义.

228 {
229 return std::sqrt(vx * vx + vy * vy);
230}

◆ Speed() [2/2]

double apollo::third_party_perception::Speed ( const Point point)

在文件 third_party_perception_util.cc224 行定义.

224 {
225 return std::sqrt(point.x() * point.x() + point.y() + point.y());
226}