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

#include <planning_base.h>

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

Public 成员函数

 PlanningBase ()=delete
 
 PlanningBase (const std::shared_ptr< DependencyInjector > &injector)
 
virtual ~PlanningBase ()
 
virtual apollo::common::Status Init (const PlanningConfig &config)
 
virtual std::string Name () const =0
 
virtual void RunOnce (const LocalView &local_view, ADCTrajectory *const adc_trajectory)=0
 
virtual apollo::common::Status Plan (const double current_time_stamp, const std::vector< common::TrajectoryPoint > &stitching_trajectory, ADCTrajectory *const trajectory)=0
 Plan the trajectory given current vehicle state
 
bool IsPlanningFinished (const ADCTrajectory::TrajectoryType &current_trajectory_type) const
 Check if vehicle reaches the end point of the RoutingRequest.
 
bool GenerateWidthOfLane (const Vec2d &current_location, Vec2d &left_point, Vec2d &right_point)
 

Protected 成员函数

virtual void FillPlanningPb (const double timestamp, ADCTrajectory *const trajectory_pb)
 
void LoadPlanner ()
 

Protected 属性

LocalView local_view_
 
const hdmap::HDMap * hdmap_ = nullptr
 
double start_time_ = 0.0
 
size_t seq_num_ = 0
 
PlanningConfig config_
 
TrafficDecider traffic_decider_
 
std::unique_ptr< Frame > frame_
 
std::shared_ptr< Planner > planner_
 
std::unique_ptr< PublishableTrajectory > last_publishable_trajectory_
 
std::shared_ptr< DependencyInjector > injector_
 

详细描述

在文件 planning_base.h 第 58 行定义.

构造及析构函数说明

◆ PlanningBase() [1/2]

apollo::planning::PlanningBase::PlanningBase ( )
delete

◆ PlanningBase() [2/2]

apollo::planning::PlanningBase::PlanningBase ( const std::shared_ptr< DependencyInjector > &  injector)
explicit

在文件 planning_base.cc 第 39 行定义.

40 : injector_(injector) {}
std::shared_ptr< DependencyInjector > injector_

◆ ~PlanningBase()

apollo::planning::PlanningBase::~PlanningBase ( )
virtual

在文件 planning_base.cc 第 42 行定义.

42{}

成员函数说明

◆ FillPlanningPb()

void apollo::planning::PlanningBase::FillPlanningPb ( const double  timestamp,
ADCTrajectory *const  trajectory_pb 
)
protectedvirtual

在文件 planning_base.cc 第 98 行定义.

99 {
100 trajectory_pb->mutable_header()->set_timestamp_sec(timestamp);
101 if (local_view_.prediction_obstacles->has_header()) {
102 trajectory_pb->mutable_header()->set_lidar_timestamp(
103 local_view_.prediction_obstacles->header().lidar_timestamp());
104 trajectory_pb->mutable_header()->set_camera_timestamp(
105 local_view_.prediction_obstacles->header().camera_timestamp());
106 trajectory_pb->mutable_header()->set_radar_timestamp(
107 local_view_.prediction_obstacles->header().radar_timestamp());
108 }
109 trajectory_pb->mutable_routing_header()->CopyFrom(
110 local_view_.planning_command->header());
111}
std::shared_ptr< PlanningCommand > planning_command
Definition local_view.h:48
std::shared_ptr< prediction::PredictionObstacles > prediction_obstacles
Definition local_view.h:41

◆ GenerateWidthOfLane()

bool apollo::planning::PlanningBase::GenerateWidthOfLane ( const Vec2d &  current_location,
Vec2d &  left_point,
Vec2d &  right_point 
)

在文件 planning_base.cc 第 125 行定义.

126 {
127 double left_width = 0, right_width = 0;
128 const auto frame = injector_->frame_history()->Latest();
129 if (nullptr == frame || frame->reference_line_info().empty()) {
130 AINFO << "Reference lane is empty!";
131 return false;
132 }
133 const auto& reference_line_info = frame->reference_line_info().front();
134 // get current SL
135 common::SLPoint current_sl;
136 reference_line_info.reference_line().XYToSL(current_location, &current_sl);
137 // Get the lane width of vehicle location
138 bool get_width_of_lane = reference_line_info.reference_line().GetLaneWidth(
139 current_sl.s(), &left_width, &right_width);
140 AINFO << "get_width_of_lane: " << get_width_of_lane
141 << ", left_width: " << left_width << ", right_width: " << right_width;
142 if (get_width_of_lane && left_width != 0 && right_width != 0) {
143 AINFO << "Get the width of lane successfully!";
144 SLPoint sl_left_point, sl_right_point;
145 sl_left_point.set_s(current_sl.s());
146 sl_left_point.set_l(left_width);
147 sl_right_point.set_s(current_sl.s());
148 sl_right_point.set_l(-right_width);
149 reference_line_info.reference_line().SLToXY(sl_left_point, &left_point);
150 reference_line_info.reference_line().SLToXY(sl_right_point, &right_point);
151 return true;
152 } else {
153 AINFO << "Failed to get the width of lane!";
154 return false;
155 }
156}
#define AINFO
Definition log.h:42

◆ Init()

Status apollo::planning::PlanningBase::Init ( const PlanningConfig &  config)
virtual

被 apollo::planning::NaviPlanning , 以及 apollo::planning::OnLanePlanning 重载.

在文件 planning_base.cc 第 44 行定义.

44 {
45 injector_->planning_context()->Init();
46 config_ = config;
47 return Status::OK();
48}
static Status OK()
generate a success status.
Definition status.h:60

◆ IsPlanningFinished()

bool apollo::planning::PlanningBase::IsPlanningFinished ( const ADCTrajectory::TrajectoryType &  current_trajectory_type) const

Check if vehicle reaches the end point of the RoutingRequest.

返回
True if vehicle reaches the end point.

在文件 planning_base.cc 第 50 行定义.

51 {
52 const auto frame = injector_->frame_history()->Latest();
53 if (current_trajectory_type == apollo::planning::ADCTrajectory::OPEN_SPACE) {
54 AINFO << "Current trajectory type is: OPEN SPACE";
55 if (frame->open_space_info().openspace_planning_finish()) {
56 AINFO << "OPEN SPACE: planning finished";
57 return true;
58 } else {
59 AINFO << "OPEN SPACE: planning not finished";
60 return false;
61 }
62 } else {
63 // const auto frame = injector_->frame_history()->Latest();
64 if (nullptr == frame || frame->reference_line_info().empty() ||
65 nullptr == local_view_.planning_command) {
66 AINFO << "Current reference point is empty;";
67 return true;
68 }
69 const auto& reference_line_info = frame->reference_line_info().front();
70 // Check if the ReferenceLineInfo is the last passage.
71 const auto& reference_points =
72 reference_line_info.reference_line().reference_points();
73 if (reference_points.empty()) {
74 AINFO << "Current reference points is empty;";
75 return true;
76 }
77 const auto& last_reference_point = reference_points.back();
78 const std::vector<hdmap::LaneWaypoint>& lane_way_points =
79 last_reference_point.lane_waypoints();
80 if (lane_way_points.empty()) {
81 AINFO << "Last reference point is empty;";
82 return true;
83 }
84 // Get the end lane way point.
85 if (nullptr == frame->local_view().end_lane_way_point) {
86 AINFO << "Current end lane way is empty;";
87 return true;
88 }
89 bool is_has_passed_destination = injector_->planning_context()
90 ->planning_status()
91 .destination()
92 .has_passed_destination();
93 AINFO << "Current passed destination:" << is_has_passed_destination;
94 return is_has_passed_destination;
95 }
96}

◆ LoadPlanner()

void apollo::planning::PlanningBase::LoadPlanner ( )
protected

在文件 planning_base.cc 第 113 行定义.

113 {
114 // Use PublicRoadPlanner as default Planner
115 std::string planner_name = "apollo::planning::PublicRoadPlanner";
116 if ("" != config_.planner()) {
117 planner_name = config_.planner();
118 planner_name = ConfigUtil::GetFullPlanningClassName(planner_name);
119 }
120 planner_ =
122 planner_name);
123}
static PluginManager * Instance()
get singleton instance of PluginManager
std::shared_ptr< Base > CreateInstance(const std::string &derived_class)
create plugin instance of derived class based on Base
static std::string GetFullPlanningClassName(const std::string &class_name)
Given the class name of planning module, combine the namespace "apollo::planning::" with it to create...
std::shared_ptr< Planner > planner_

◆ Name()

virtual std::string apollo::planning::PlanningBase::Name ( ) const
pure virtual

◆ Plan()

virtual apollo::common::Status apollo::planning::PlanningBase::Plan ( const double  current_time_stamp,
const std::vector< common::TrajectoryPoint > &  stitching_trajectory,
ADCTrajectory *const  trajectory 
)
pure virtual

Plan the trajectory given current vehicle state

在 apollo::planning::NaviPlanning , 以及 apollo::planning::OnLanePlanning 内被实现.

◆ RunOnce()

virtual void apollo::planning::PlanningBase::RunOnce ( const LocalView &  local_view,
ADCTrajectory *const  adc_trajectory 
)
pure virtual

类成员变量说明

◆ config_

PlanningConfig apollo::planning::PlanningBase::config_
protected

在文件 planning_base.h 第 104 行定义.

◆ frame_

std::unique_ptr<Frame> apollo::planning::PlanningBase::frame_
protected

在文件 planning_base.h 第 106 行定义.

◆ hdmap_

const hdmap::HDMap* apollo::planning::PlanningBase::hdmap_ = nullptr
protected

在文件 planning_base.h 第 99 行定义.

◆ injector_

std::shared_ptr<DependencyInjector> apollo::planning::PlanningBase::injector_
protected

在文件 planning_base.h 第 109 行定义.

◆ last_publishable_trajectory_

std::unique_ptr<PublishableTrajectory> apollo::planning::PlanningBase::last_publishable_trajectory_
protected

在文件 planning_base.h 第 108 行定义.

◆ local_view_

LocalView apollo::planning::PlanningBase::local_view_
protected

在文件 planning_base.h 第 98 行定义.

◆ planner_

std::shared_ptr<Planner> apollo::planning::PlanningBase::planner_
protected

在文件 planning_base.h 第 107 行定义.

◆ seq_num_

size_t apollo::planning::PlanningBase::seq_num_ = 0
protected

在文件 planning_base.h 第 102 行定义.

◆ start_time_

double apollo::planning::PlanningBase::start_time_ = 0.0
protected

在文件 planning_base.h 第 101 行定义.

◆ traffic_decider_

TrafficDecider apollo::planning::PlanningBase::traffic_decider_
protected

在文件 planning_base.h 第 105 行定义.


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