Apollo 11.0
自动驾驶开放平台
apollo::planning::PathTimeGraph类 参考

#include <path_time_graph.h>

apollo::planning::PathTimeGraph 的协作图:

Public 成员函数

 PathTimeGraph (const std::vector< const Obstacle * > &obstacles, const std::vector< common::PathPoint > &discretized_ref_points, const ReferenceLineInfo *ptr_reference_line_info, const double s_start, const double s_end, const double t_start, const double t_end, const std::array< double, 3 > &init_d)
 
const std::vector< STBoundary > & GetPathTimeObstacles () const
 
bool GetPathTimeObstacle (const std::string &obstacle_id, STBoundary *path_time_obstacle)
 
std::vector< std::pair< double, double > > GetPathBlockingIntervals (const double t) const
 
std::vector< std::vector< std::pair< double, double > > > GetPathBlockingIntervals (const double t_start, const double t_end, const double t_resolution)
 
std::pair< double, double > get_path_range () const
 
std::pair< double, double > get_time_range () const
 
std::vector< STPoint > GetObstacleSurroundingPoints (const std::string &obstacle_id, const double s_dist, const double t_density) const
 
bool IsObstacleInGraph (const std::string &obstacle_id)
 
std::vector< std::pair< double, double > > GetLateralBounds (const double s_start, const double s_end, const double s_resolution)
 

详细描述

在文件 path_time_graph.h 第 41 行定义.

构造及析构函数说明

◆ PathTimeGraph()

apollo::planning::PathTimeGraph::PathTimeGraph ( const std::vector< const Obstacle * > &  obstacles,
const std::vector< common::PathPoint > &  discretized_ref_points,
const ReferenceLineInfo *  ptr_reference_line_info,
const double  s_start,
const double  s_end,
const double  t_start,
const double  t_end,
const std::array< double, 3 > &  init_d 
)

在文件 path_time_graph.cc 第 43 行定义.

48 {
49 CHECK_LT(s_start, s_end);
50 CHECK_LT(t_start, t_end);
51 path_range_.first = s_start;
52 path_range_.second = s_end;
53 time_range_.first = t_start;
54 time_range_.second = t_end;
55 ptr_reference_line_info_ = ptr_reference_line_info;
56 init_d_ = init_d;
57
58 SetupObstacles(obstacles, discretized_ref_points);
59}

成员函数说明

◆ get_path_range()

std::pair< double, double > apollo::planning::PathTimeGraph::get_path_range ( ) const

在文件 path_time_graph.cc 第 250 行定义.

250 {
251 return path_range_;
252}

◆ get_time_range()

std::pair< double, double > apollo::planning::PathTimeGraph::get_time_range ( ) const

在文件 path_time_graph.cc 第 254 行定义.

254 {
255 return time_range_;
256}

◆ GetLateralBounds()

std::vector< std::pair< double, double > > apollo::planning::PathTimeGraph::GetLateralBounds ( const double  s_start,
const double  s_end,
const double  s_resolution 
)

在文件 path_time_graph.cc 第 314 行定义.

315 {
316 CHECK_LT(s_start, s_end);
317 CHECK_GT(s_resolution, FLAGS_numerical_epsilon);
318 std::vector<std::pair<double, double>> bounds;
319 std::vector<double> discretized_path;
320 double s_range = s_end - s_start;
321 double s_curr = s_start;
322 size_t num_bound = static_cast<size_t>(s_range / s_resolution);
323
324 const auto& vehicle_config =
325 common::VehicleConfigHelper::Instance()->GetConfig();
326 double ego_width = vehicle_config.vehicle_param().width();
327
328 // Initialize bounds by reference line width
329 for (size_t i = 0; i < num_bound; ++i) {
330 double left_width = FLAGS_default_reference_line_width / 2.0;
331 double right_width = FLAGS_default_reference_line_width / 2.0;
332 ptr_reference_line_info_->reference_line().GetLaneWidth(s_curr, &left_width,
333 &right_width);
334 double ego_d_lower = init_d_[0] - ego_width / 2.0;
335 double ego_d_upper = init_d_[0] + ego_width / 2.0;
336 bounds.emplace_back(
337 std::min(-right_width, ego_d_lower - FLAGS_bound_buffer),
338 std::max(left_width, ego_d_upper + FLAGS_bound_buffer));
339 discretized_path.push_back(s_curr);
340 s_curr += s_resolution;
341 }
342
343 for (const SLBoundary& static_sl_boundary : static_obs_sl_boundaries_) {
344 UpdateLateralBoundsByObstacle(static_sl_boundary, discretized_path, s_start,
345 s_end, &bounds);
346 }
347
348 for (size_t i = 0; i < bounds.size(); ++i) {
349 bounds[i].first += ego_width / 2.0;
350 bounds[i].second -= ego_width / 2.0;
351 if (bounds[i].first >= bounds[i].second) {
352 bounds[i].first = 0.0;
353 bounds[i].second = 0.0;
354 }
355 }
356 return bounds;
357}
const ReferenceLine & reference_line() const
bool GetLaneWidth(const double s, double *const lane_left_width, double *const lane_right_width) const

◆ GetObstacleSurroundingPoints()

std::vector< STPoint > apollo::planning::PathTimeGraph::GetObstacleSurroundingPoints ( const std::string &  obstacle_id,
const double  s_dist,
const double  t_density 
) const

在文件 path_time_graph.cc 第 258 行定义.

260 {
261 ACHECK(t_min_density > 0.0);
262 std::vector<STPoint> pt_pairs;
263 if (path_time_obstacle_map_.find(obstacle_id) ==
264 path_time_obstacle_map_.end()) {
265 return pt_pairs;
266 }
267
268 const auto& pt_obstacle = path_time_obstacle_map_.at(obstacle_id);
269
270 double s0 = 0.0;
271 double s1 = 0.0;
272
273 double t0 = 0.0;
274 double t1 = 0.0;
275 if (s_dist > 0.0) {
276 s0 = pt_obstacle.upper_left_point().s();
277 s1 = pt_obstacle.upper_right_point().s();
278
279 t0 = pt_obstacle.upper_left_point().t();
280 t1 = pt_obstacle.upper_right_point().t();
281 } else {
282 s0 = pt_obstacle.bottom_left_point().s();
283 s1 = pt_obstacle.bottom_right_point().s();
284
285 t0 = pt_obstacle.bottom_left_point().t();
286 t1 = pt_obstacle.bottom_right_point().t();
287 }
288
289 double time_gap = t1 - t0;
290 ACHECK(time_gap > -FLAGS_numerical_epsilon);
291 time_gap = std::fabs(time_gap);
292
293 size_t num_sections = static_cast<size_t>(time_gap / t_min_density + 1);
294 double t_interval = time_gap / static_cast<double>(num_sections);
295
296 for (size_t i = 0; i <= num_sections; ++i) {
297 double t = t_interval * static_cast<double>(i) + t0;
298 double s = lerp(s0, t0, s1, t1, t) + s_dist;
299
300 STPoint ptt;
301 ptt.set_t(t);
302 ptt.set_s(s);
303 pt_pairs.push_back(std::move(ptt));
304 }
305
306 return pt_pairs;
307}
#define ACHECK(cond)
Definition log.h:80
T lerp(const T &x0, const double t0, const T &x1, const double t1, const double t)
Linear interpolation between two points of type T.

◆ GetPathBlockingIntervals() [1/2]

std::vector< std::pair< double, double > > apollo::planning::PathTimeGraph::GetPathBlockingIntervals ( const double  t) const

在文件 path_time_graph.cc 第 216 行定义.

217 {
218 ACHECK(time_range_.first <= t && t <= time_range_.second);
219 std::vector<std::pair<double, double>> intervals;
220 for (const auto& pt_obstacle : path_time_obstacles_) {
221 if (t > pt_obstacle.max_t() || t < pt_obstacle.min_t()) {
222 continue;
223 }
224 double s_upper = lerp(pt_obstacle.upper_left_point().s(),
225 pt_obstacle.upper_left_point().t(),
226 pt_obstacle.upper_right_point().s(),
227 pt_obstacle.upper_right_point().t(), t);
228
229 double s_lower = lerp(pt_obstacle.bottom_left_point().s(),
230 pt_obstacle.bottom_left_point().t(),
231 pt_obstacle.bottom_right_point().s(),
232 pt_obstacle.bottom_right_point().t(), t);
233
234 intervals.emplace_back(s_lower, s_upper);
235 }
236 return intervals;
237}

◆ GetPathBlockingIntervals() [2/2]

std::vector< std::vector< std::pair< double, double > > > apollo::planning::PathTimeGraph::GetPathBlockingIntervals ( const double  t_start,
const double  t_end,
const double  t_resolution 
)

在文件 path_time_graph.cc 第 240 行定义.

242 {
243 std::vector<std::vector<std::pair<double, double>>> intervals;
244 for (double t = t_start; t <= t_end; t += t_resolution) {
245 intervals.push_back(GetPathBlockingIntervals(t));
246 }
247 return intervals;
248}
std::vector< std::pair< double, double > > GetPathBlockingIntervals(const double t) const

◆ GetPathTimeObstacle()

bool apollo::planning::PathTimeGraph::GetPathTimeObstacle ( const std::string &  obstacle_id,
STBoundary *  path_time_obstacle 
)

在文件 path_time_graph.cc 第 206 行定义.

207 {
208 if (path_time_obstacle_map_.find(obstacle_id) ==
209 path_time_obstacle_map_.end()) {
210 return false;
211 }
212 *path_time_obstacle = path_time_obstacle_map_[obstacle_id];
213 return true;
214}

◆ GetPathTimeObstacles()

const std::vector< STBoundary > & apollo::planning::PathTimeGraph::GetPathTimeObstacles ( ) const

在文件 path_time_graph.cc 第 202 行定义.

202 {
203 return path_time_obstacles_;
204}

◆ IsObstacleInGraph()

bool apollo::planning::PathTimeGraph::IsObstacleInGraph ( const std::string &  obstacle_id)

在文件 path_time_graph.cc 第 309 行定义.

309 {
310 return path_time_obstacle_map_.find(obstacle_id) !=
311 path_time_obstacle_map_.end();
312}

该类的文档由以下文件生成: