Apollo 10.0
自动驾驶开放平台
apollo::planning::BareIntersectionUnprotectedScenario类 参考

#include <bare_intersection_unprotected_scenario.h>

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

Public 成员函数

bool Init (std::shared_ptr< DependencyInjector > injector, const std::string &name) override
 
BareIntersectionUnprotectedContextGetContext () override
 Get the scenario context.
 
bool IsTransferable (const Scenario *other_scenario, const Frame &frame) override
 Each scenario should define its own transfer condition, i.e., when it should allow to transfer from other scenario to itself.
 
bool Enter (Frame *frame) override
 
- Public 成员函数 继承自 apollo::planning::Scenario
 Scenario ()
 
virtual ~Scenario ()=default
 
virtual ScenarioResult Process (const common::TrajectoryPoint &planning_init_point, Frame *frame)
 
virtual bool Exit (Frame *frame)
 
std::shared_ptr< StageCreateStage (const StagePipeline &stage_pipeline)
 Each scenario should define its own stages object's creation scenario will call stage's Stage::Process function following a configured order, The return value of Stage::Process function determines the transition from one stage to another.
 
const ScenarioStatusTypeGetStatus () const
 
const std::string GetStage () const
 
const std::string & GetMsg () const
 
const std::string & Name () const
 
void Reset ()
 Reset the scenario, used before entering the scenario.
 

额外继承的成员函数

- Protected 成员函数 继承自 apollo::planning::Scenario
template<typename T >
bool LoadConfig (T *config)
 
- Protected 属性 继承自 apollo::planning::Scenario
ScenarioResult scenario_result_
 
std::shared_ptr< Stagecurrent_stage_
 
std::unordered_map< std::string, const StagePipeline * > stage_pipeline_map_
 
std::string msg_
 
std::shared_ptr< DependencyInjectorinjector_
 
std::string config_path_
 
std::string config_dir_
 
std::string name_
 
ScenarioPipeline scenario_pipeline_config_
 

详细描述

在文件 bare_intersection_unprotected_scenario.h41 行定义.

成员函数说明

◆ Enter()

bool apollo::planning::BareIntersectionUnprotectedScenario::Enter ( Frame frame)
overridevirtual

重载 apollo::planning::Scenario .

在文件 bare_intersection_unprotected_scenario.cc129 行定义.

129 {
130 // set to first_encountered pnc_junction
131 const auto& first_encountered_overlaps =
132 frame->reference_line_info().front().FirstEncounteredOverlaps();
133 for (const auto& overlap : first_encountered_overlaps) {
134 if (overlap.first == ReferenceLineInfo::PNC_JUNCTION) {
135 context_.current_pnc_junction_overlap_id = overlap.second.object_id;
136 ADEBUG << "Update PlanningContext with first_encountered pnc_junction["
137 << overlap.second.object_id << "] start_s["
138 << overlap.second.start_s << "]";
139 break;
140 }
141 }
142 return true;
143}
#define ADEBUG
Definition log.h:41

◆ GetContext()

BareIntersectionUnprotectedContext * apollo::planning::BareIntersectionUnprotectedScenario::GetContext ( )
inlineoverridevirtual

Get the scenario context.

实现了 apollo::planning::Scenario.

在文件 bare_intersection_unprotected_scenario.h48 行定义.

48 {
49 return &context_;
50 }

◆ Init()

bool apollo::planning::BareIntersectionUnprotectedScenario::Init ( std::shared_ptr< DependencyInjector injector,
const std::string &  name 
)
overridevirtual

重载 apollo::planning::Scenario .

在文件 bare_intersection_unprotected_scenario.cc35 行定义.

36 {
37 if (init_) {
38 return true;
39 }
40
41 if (!Scenario::Init(injector, name)) {
42 AERROR << "failed to init scenario " << name;
43 return false;
44 }
45
46 if (!Scenario::LoadConfig<ScenarioBareIntersectionUnprotectedConfig>(
47 &context_.scenario_config)) {
48 AERROR << "fail to get scenario specific config in" << name;
49 return false;
50 }
51 init_ = true;
52 return true;
53}
virtual bool Init(std::shared_ptr< DependencyInjector > injector, const std::string &name)
Definition scenario.cc:43
#define AERROR
Definition log.h:44

◆ IsTransferable()

bool apollo::planning::BareIntersectionUnprotectedScenario::IsTransferable ( const Scenario other_scenario,
const Frame frame 
)
overridevirtual

Each scenario should define its own transfer condition, i.e., when it should allow to transfer from other scenario to itself.

重载 apollo::planning::Scenario .

在文件 bare_intersection_unprotected_scenario.cc59 行定义.

60 {
61 if (!frame.local_view().planning_command->has_lane_follow_command()) {
62 return false;
63 }
64 if (other_scenario == nullptr || frame.reference_line_info().empty()) {
65 return false;
66 }
67 const auto& reference_line_info = frame.reference_line_info().front();
68 const auto& first_encountered_overlaps =
69 reference_line_info.FirstEncounteredOverlaps();
70 hdmap::PathOverlap* pnc_junction_overlap = nullptr;
71 hdmap::PathOverlap* traffic_sign_overlap = nullptr;
72 // note: first_encountered_overlaps already sorted
73 if (first_encountered_overlaps.empty()) {
74 return false;
75 }
76
77 for (const auto& overlap : first_encountered_overlaps) {
78 if ((overlap.first == ReferenceLineInfo::SIGNAL ||
79 overlap.first == ReferenceLineInfo::STOP_SIGN ||
80 overlap.first == ReferenceLineInfo::YIELD_SIGN) &&
81 traffic_sign_overlap == nullptr) {
82 traffic_sign_overlap = const_cast<hdmap::PathOverlap*>(&overlap.second);
83 break;
84 } else if (overlap.first == ReferenceLineInfo::PNC_JUNCTION &&
85 pnc_junction_overlap == nullptr) {
86 pnc_junction_overlap = const_cast<hdmap::PathOverlap*>(&overlap.second);
87 }
88 }
89
90 if (traffic_sign_overlap && pnc_junction_overlap) {
91 static constexpr double kJunctionDelta = 10.0;
92 double s_diff = std::fabs(traffic_sign_overlap->start_s -
93 pnc_junction_overlap->start_s);
94 if (s_diff >= kJunctionDelta) {
95 if (pnc_junction_overlap->start_s > traffic_sign_overlap->start_s) {
96 pnc_junction_overlap = nullptr;
97 } else {
98 traffic_sign_overlap = nullptr;
99 }
100 }
101 }
102
103 if (traffic_sign_overlap || !pnc_junction_overlap) {
104 return false;
105 }
106
107 if (reference_line_info.GetIntersectionRightofWayStatus(
108 *pnc_junction_overlap)) {
109 return false;
110 }
111
112 const double adc_front_edge_s = reference_line_info.AdcSlBoundary().end_s();
113 const double adc_distance_to_pnc_junction =
114 pnc_junction_overlap->start_s - adc_front_edge_s;
115 ADEBUG << "adc_distance_to_pnc_junction[" << adc_distance_to_pnc_junction
116 << "] pnc_junction[" << pnc_junction_overlap->object_id
117 << "] pnc_junction_overlap_start_s[" << pnc_junction_overlap->start_s
118 << "]";
119
120 const bool bare_junction_scenario =
121 (adc_distance_to_pnc_junction > 0.0 &&
122 adc_distance_to_pnc_junction <=
123 context_.scenario_config
125
126 return bare_junction_scenario;
127}

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