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

#include <prediction_querier.h>

apollo::planning::PredictionQuerier 的协作图:

Public 成员函数

 PredictionQuerier (const std::vector< const Obstacle * > &obstacles, const std::shared_ptr< std::vector< common::PathPoint > > &ptr_reference_line)
 
virtual ~PredictionQuerier ()=default
 
std::vector< const Obstacle * > GetObstacles () const
 
double ProjectVelocityAlongReferenceLine (const std::string &obstacle_id, const double s, const double t) const
 

详细描述

在文件 prediction_querier.h 第 33 行定义.

构造及析构函数说明

◆ PredictionQuerier()

apollo::planning::PredictionQuerier::PredictionQuerier ( const std::vector< const Obstacle * > &  obstacles,
const std::shared_ptr< std::vector< common::PathPoint > > &  ptr_reference_line 
)

在文件 prediction_querier.cc 第 29 行定义.

32 : ptr_reference_line_(ptr_reference_line) {
33 for (const auto ptr_obstacle : obstacles) {
34 if (common::util::InsertIfNotPresent(&id_obstacle_map_, ptr_obstacle->Id(),
35 ptr_obstacle)) {
36 obstacles_.push_back(ptr_obstacle);
37 } else {
38 AWARN << "Duplicated obstacle found [" << ptr_obstacle->Id() << "]";
39 }
40 }
41}
#define AWARN
Definition log.h:43

◆ ~PredictionQuerier()

virtual apollo::planning::PredictionQuerier::~PredictionQuerier ( )
virtualdefault

成员函数说明

◆ GetObstacles()

std::vector< const Obstacle * > apollo::planning::PredictionQuerier::GetObstacles ( ) const

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

43 {
44 return obstacles_;
45}

◆ ProjectVelocityAlongReferenceLine()

double apollo::planning::PredictionQuerier::ProjectVelocityAlongReferenceLine ( const std::string &  obstacle_id,
const double  s,
const double  t 
) const

在文件 prediction_querier.cc 第 47 行定义.

48 {
49 ACHECK(id_obstacle_map_.find(obstacle_id) != id_obstacle_map_.end());
50
51 const auto& trajectory = id_obstacle_map_.at(obstacle_id)->Trajectory();
52 int num_traj_point = trajectory.trajectory_point_size();
53 if (num_traj_point < 2) {
54 return 0.0;
55 }
56
57 if (t < trajectory.trajectory_point(0).relative_time() ||
58 t > trajectory.trajectory_point(num_traj_point - 1).relative_time()) {
59 return 0.0;
60 }
61
62 auto matched_it =
63 std::lower_bound(trajectory.trajectory_point().begin(),
64 trajectory.trajectory_point().end(), t,
65 [](const common::TrajectoryPoint& p, const double t) {
66 return p.relative_time() < t;
67 });
68
69 double v = matched_it->v();
70 double theta = matched_it->path_point().theta();
71 double v_x = v * std::cos(theta);
72 double v_y = v * std::sin(theta);
73
74 common::PathPoint obstacle_point_on_ref_line =
75 common::math::PathMatcher::MatchToPath(*ptr_reference_line_, s);
76 auto ref_theta = obstacle_point_on_ref_line.theta();
77
78 return std::cos(ref_theta) * v_x + std::sin(ref_theta) * v_y;
79}
static PathPoint MatchToPath(const std::vector< PathPoint > &reference_line, const double x, const double y)
#define ACHECK(cond)
Definition log.h:80

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