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

#include <path_generation.h>

类 apollo::planning::PathGeneration 继承关系图:
apollo::planning::PathGeneration 的协作图:

Public 成员函数

virtual ~PathGeneration ()=default
 
apollo::common::Status Execute (Frame *frame, ReferenceLineInfo *reference_line_info) override
 
apollo::common::Status Execute (Frame *frame) override
 
- Public 成员函数 继承自 apollo::planning::Task
 Task ()
 
virtual ~Task ()=default
 
const std::string & Name () const
 
virtual bool Init (const std::string &config_dir, const std::string &name, const std::shared_ptr< DependencyInjector > &injector)
 

Protected 成员函数

virtual apollo::common::Status Process (Frame *frame, ReferenceLineInfo *reference_line_info)
 
virtual apollo::common::Status Process (Frame *frame)
 
void GetStartPointSLState ()
 calculate init sl state by planning start point, result will store in init_sl_state_
 
void RecordDebugInfo (const PathBound &path_boundaries, const std::string &debug_name, ReferenceLineInfo *const reference_line_info)
 add path_boundary debug info for PnC monitor
 
void RecordDebugInfo (const PathData &path_data, const std::string &debug_name, ReferenceLineInfo *const reference_line_info)
 add path debug info for PnC monitor
 
bool GetSLBoundary (const PathData &path_data, int point_index, const ReferenceLineInfo *reference_line_info, SLBoundary *const sl_boundary)
 get sl boundary of the point on PathData
 
- Protected 成员函数 继承自 apollo::planning::Task
template<typename T >
bool LoadConfig (T *config)
 

Protected 属性

SLState init_sl_state_
 
std::vector< SLPolygonobs_sl_polygons_
 
- Protected 属性 继承自 apollo::planning::Task
Frameframe_
 
ReferenceLineInforeference_line_info_
 
std::shared_ptr< DependencyInjectorinjector_
 
std::string config_path_
 
std::string default_config_path_
 
std::string name_
 

详细描述

在文件 path_generation.h31 行定义.

构造及析构函数说明

◆ ~PathGeneration()

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

成员函数说明

◆ Execute() [1/2]

apollo::common::Status apollo::planning::PathGeneration::Execute ( Frame frame)
overridevirtual

重载 apollo::planning::Task .

在文件 path_generation.cc37 行定义.

37 {
38 Task::Execute(frame);
39 return Process(frame);
40}
virtual apollo::common::Status Process(Frame *frame, ReferenceLineInfo *reference_line_info)
virtual common::Status Execute(Frame *frame, ReferenceLineInfo *reference_line_info)
Definition task.cc:60

◆ Execute() [2/2]

apollo::common::Status apollo::planning::PathGeneration::Execute ( Frame frame,
ReferenceLineInfo reference_line_info 
)
overridevirtual

重载 apollo::planning::Task .

在文件 path_generation.cc31 行定义.

32 {
33 Task::Execute(frame, reference_line_info);
34 return Process(frame, reference_line_info);
35}

◆ GetSLBoundary()

bool apollo::planning::PathGeneration::GetSLBoundary ( const PathData path_data,
int  point_index,
const ReferenceLineInfo reference_line_info,
SLBoundary *const  sl_boundary 
)
protected

get sl boundary of the point on PathData

参数
path_dataPathData which the point is on
point_indexindex of the point on PathData
sl_boundaryoutput SLBoundary of the point
返回
True if SLBoundary is found

在文件 path_generation.cc134 行定义.

136 {
137 CHECK_NOTNULL(sl_boundary);
138 const auto& discrete_path = path_data.discretized_path();
139 if (point_index < 0 ||
140 static_cast<size_t>(point_index) > discrete_path.size()) {
141 return false;
142 }
143 sl_boundary->mutable_boundary_point()->Clear();
144 // Get vehicle config parameters.
145 const auto& vehicle_config =
146 common::VehicleConfigHelper::Instance()->GetConfig();
147 const double ego_length = vehicle_config.vehicle_param().length();
148 const double ego_width = vehicle_config.vehicle_param().width();
149 const double ego_back_to_center =
150 vehicle_config.vehicle_param().back_edge_to_center();
151 const double ego_center_shift_distance =
152 ego_length / 2.0 - ego_back_to_center;
153 // Generate vehicle bounding box.
154 const auto& rear_center_path_point = discrete_path[point_index];
155 const double ego_theta = rear_center_path_point.theta();
156 common::math::Box2d ego_box(
157 {rear_center_path_point.x(), rear_center_path_point.y()}, ego_theta,
158 ego_length, ego_width);
159 common::math::Vec2d shift_vec{
160 ego_center_shift_distance * ego_box.cos_heading(),
161 ego_center_shift_distance * ego_box.sin_heading()};
162 ego_box.Shift(shift_vec);
163 // Set warm_start_s near the geometry center of the box.
164 double warm_start_s = path_data.frenet_frame_path()[point_index].s() +
165 ego_center_shift_distance;
166 // Get the SL boundary of vehicle.
167 reference_line_info->reference_line().GetSLBoundary(ego_box, sl_boundary,
168 warm_start_s);
169 return true;
170}

◆ GetStartPointSLState()

void apollo::planning::PathGeneration::GetStartPointSLState ( )
protected

calculate init sl state by planning start point, result will store in init_sl_state_

在文件 path_generation.cc107 行定义.

107 {
108 const ReferenceLine& reference_line = reference_line_info_->reference_line();
109 common::TrajectoryPoint planning_start_point = frame_->PlanningStartPoint();
110 if (FLAGS_use_front_axe_center_in_path_planning) {
111 double front_to_rear_axe_distance =
114 .wheel_base();
115 planning_start_point.mutable_path_point()->set_x(
116 planning_start_point.path_point().x() +
117 front_to_rear_axe_distance *
118 std::cos(planning_start_point.path_point().theta()));
119 planning_start_point.mutable_path_point()->set_y(
120 planning_start_point.path_point().y() +
121 front_to_rear_axe_distance *
122 std::sin(planning_start_point.path_point().theta()));
123 }
124 AINFO << std::fixed << "Plan at the starting point: x = "
125 << planning_start_point.path_point().x()
126 << ", y = " << planning_start_point.path_point().y()
127 << ", and angle = " << planning_start_point.path_point().theta();
128
129 // Initialize some private variables.
130 // ADC s/l info.
131 init_sl_state_ = reference_line.ToFrenetFrame(planning_start_point);
132}
static const VehicleConfig & GetConfig()
Get the current vehicle configuration.
const common::TrajectoryPoint & PlanningStartPoint() const
Definition frame.cc:79
const ReferenceLine & reference_line() const
ReferenceLineInfo * reference_line_info_
Definition task.h:58
#define AINFO
Definition log.h:42
optional VehicleParam vehicle_param

◆ Process() [1/2]

virtual apollo::common::Status apollo::planning::PathGeneration::Process ( Frame frame)
inlineprotectedvirtual

在文件 path_generation.h46 行定义.

46 {
48 }
static Status OK()
generate a success status.
Definition status.h:60

◆ Process() [2/2]

virtual apollo::common::Status apollo::planning::PathGeneration::Process ( Frame frame,
ReferenceLineInfo reference_line_info 
)
inlineprotectedvirtual

在文件 path_generation.h41 行定义.

42 {
44 }

◆ RecordDebugInfo() [1/2]

void apollo::planning::PathGeneration::RecordDebugInfo ( const PathBound path_boundaries,
const std::string &  debug_name,
ReferenceLineInfo *const  reference_line_info 
)
protected

add path_boundary debug info for PnC monitor

在文件 path_generation.cc42 行定义.

44 {
45 // Sanity checks.
46 if (path_boundaries.empty()) {
47 AINFO << "path boundary is empty!";
48 return;
49 }
50 CHECK_NOTNULL(reference_line_info);
51
52 // Take the left and right path boundaries, and transform them into two
53 // PathData so that they can be displayed in simulator.
54 std::vector<common::FrenetFramePoint> frenet_frame_left_boundaries;
55 std::vector<common::FrenetFramePoint> frenet_frame_right_boundaries;
56 for (const PathBoundPoint& path_bound_point : path_boundaries) {
57 common::FrenetFramePoint frenet_frame_point;
58 frenet_frame_point.set_s(path_bound_point.s);
59 frenet_frame_point.set_dl(0.0);
60 frenet_frame_point.set_ddl(0.0);
61
62 frenet_frame_point.set_l(path_bound_point.l_lower.l);
63 frenet_frame_right_boundaries.push_back(frenet_frame_point);
64 frenet_frame_point.set_l(path_bound_point.l_upper.l);
65 frenet_frame_left_boundaries.push_back(frenet_frame_point);
66 }
67
68 auto frenet_frame_left_path =
69 FrenetFramePath(std::move(frenet_frame_left_boundaries));
70 auto frenet_frame_right_path =
71 FrenetFramePath(std::move(frenet_frame_right_boundaries));
72
73 PathData left_path_data;
74 left_path_data.SetReferenceLine(&(reference_line_info->reference_line()));
75 left_path_data.SetFrenetPath(std::move(frenet_frame_left_path));
76 PathData right_path_data;
77 right_path_data.SetReferenceLine(&(reference_line_info->reference_line()));
78 right_path_data.SetFrenetPath(std::move(frenet_frame_right_path));
79
80 // Insert the transformed PathData into the simulator display.
81 auto* ptr_display_path_1 =
82 reference_line_info->mutable_debug()->mutable_planning_data()->add_path();
83 ptr_display_path_1->set_name(std::string("planning_path_boundary_1_") +
84 debug_name);
85 ptr_display_path_1->mutable_path_point()->CopyFrom(
86 {left_path_data.discretized_path().begin(),
87 left_path_data.discretized_path().end()});
88 auto* ptr_display_path_2 =
89 reference_line_info->mutable_debug()->mutable_planning_data()->add_path();
90 ptr_display_path_2->set_name(std::string("planning_path_boundary_2_") +
91 debug_name);
92 ptr_display_path_2->mutable_path_point()->CopyFrom(
93 {right_path_data.discretized_path().begin(),
94 right_path_data.discretized_path().end()});
95}

◆ RecordDebugInfo() [2/2]

void apollo::planning::PathGeneration::RecordDebugInfo ( const PathData path_data,
const std::string &  debug_name,
ReferenceLineInfo *const  reference_line_info 
)
protected

add path debug info for PnC monitor

在文件 path_generation.cc97 行定义.

99 {
100 const auto& path_points = path_data.discretized_path();
101 auto* ptr_optimized_path =
102 reference_line_info->mutable_debug()->mutable_planning_data()->add_path();
103 ptr_optimized_path->set_name(std::string("candidate_path_") + debug_name);
104 ptr_optimized_path->mutable_path_point()->CopyFrom(
105 {path_points.begin(), path_points.end()});
106}

类成员变量说明

◆ init_sl_state_

SLState apollo::planning::PathGeneration::init_sl_state_
protected

在文件 path_generation.h81 行定义.

◆ obs_sl_polygons_

std::vector<SLPolygon> apollo::planning::PathGeneration::obs_sl_polygons_
protected

在文件 path_generation.h82 行定义.


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