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

#include <scenario_manager.h>

apollo::planning::ScenarioManager 的协作图:

Public 成员函数

bool Init (const std::shared_ptr< DependencyInjector > &injector, const PlannerPublicRoadConfig &planner_config)
 
Scenariomutable_scenario ()
 
DependencyInjectorinjector ()
 
void Update (const common::TrajectoryPoint &ego_point, Frame *frame)
 
void Reset (Frame *frame)
 

详细描述

在文件 scenario_manager.h39 行定义.

成员函数说明

◆ Init()

bool apollo::planning::ScenarioManager::Init ( const std::shared_ptr< DependencyInjector > &  injector,
const PlannerPublicRoadConfig planner_config 
)

在文件 scenario_manager.cc33 行定义.

34 {
35 if (init_) {
36 return true;
37 }
38 injector_ = injector;
39 for (int i = 0; i < planner_config.scenario_size(); i++) {
40 auto scenario = PluginManager::Instance()->CreateInstance<Scenario>(
42 planner_config.scenario(i).type()));
43 ACHECK(scenario->Init(injector_, planner_config.scenario(i).name()))
44 << "Can not init scenario" << planner_config.scenario(i).name();
45 scenario_list_.push_back(scenario);
46 if (planner_config.scenario(i).name() == "LANE_FOLLOW") {
47 default_scenario_type_ = scenario;
48 }
49 }
50 AINFO << "Load scenario list:" << planner_config.DebugString();
51 current_scenario_ = default_scenario_type_;
52 init_ = true;
53 return true;
54}
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...
#define ACHECK(cond)
Definition log.h:80
#define AINFO
Definition log.h:42

◆ injector()

DependencyInjector * apollo::planning::ScenarioManager::injector ( )
inline

在文件 scenario_manager.h46 行定义.

46{ return injector_.get(); }

◆ mutable_scenario()

Scenario * apollo::planning::ScenarioManager::mutable_scenario ( )
inline

在文件 scenario_manager.h44 行定义.

44{ return current_scenario_.get(); }

◆ Reset()

void apollo::planning::ScenarioManager::Reset ( Frame frame)

在文件 scenario_manager.cc78 行定义.

78 {
79 if (current_scenario_) {
80 current_scenario_->Exit(frame);
81 }
82 AINFO << "Reset to default scenario:" << default_scenario_type_->Name();
83 default_scenario_type_->Reset();
84 current_scenario_ = default_scenario_type_;
85}

◆ Update()

void apollo::planning::ScenarioManager::Update ( const common::TrajectoryPoint ego_point,
Frame frame 
)

在文件 scenario_manager.cc56 行定义.

57 {
58 CHECK_NOTNULL(frame);
59 for (auto scenario : scenario_list_) {
60 if (current_scenario_.get() == scenario.get() &&
61 current_scenario_->GetStatus() ==
63 // The previous scenario has higher priority
64 return;
65 }
66 if (scenario->IsTransferable(current_scenario_.get(), *frame)) {
67 current_scenario_->Exit(frame);
68 AINFO << "switch scenario from " << current_scenario_->Name() << " to "
69 << scenario->Name();
70 current_scenario_ = scenario;
71 current_scenario_->Reset();
72 current_scenario_->Enter(frame);
73 return;
74 }
75 }
76}

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