Apollo 11.0
自动驾驶开放平台
apollo::prediction::PredictionComponent类 参考

#include <prediction_component.h>

类 apollo::prediction::PredictionComponent 继承关系图:
apollo::prediction::PredictionComponent 的协作图:

Public 成员函数

 ~PredictionComponent ()
 Destructor
 
std::string Name () const
 Get name of the node
 
bool Init () override
 Initialize the node
 
bool Proc (const std::shared_ptr< perception::PerceptionObstacles > &) override
 Data callback upon receiving a perception obstacle message.
 
void OfflineProcessFeatureProtoFile (const std::string &features_proto_file)
 Load and process feature proto file.
 
- Public 成员函数 继承自 apollo::cyber::Component< perception::PerceptionObstacles >
 Component ()
 
 ~Component () override
 
bool Initialize (const ComponentConfig &config) override
 init the component by protobuf object.
 
bool Process (const std::shared_ptr< perception::PerceptionObstacles > &msg0, const std::shared_ptr< NullType > &msg1, const std::shared_ptr< NullType > &msg2, const std::shared_ptr< NullType > &msg3)
 
- Public 成员函数 继承自 apollo::cyber::ComponentBase
virtual ~ComponentBase ()
 
virtual bool Initialize (const TimerComponentConfig &config)
 
virtual void Shutdown ()
 
template<typename T >
bool GetProtoConfig (T *config) const
 

额外继承的成员函数

- Public 类型 继承自 apollo::cyber::ComponentBase
template<typename M >
using Reader = cyber::Reader< M >
 
- Protected 成员函数 继承自 apollo::cyber::ComponentBase
virtual void Clear ()
 
const std::string & ConfigFilePath () const
 
void LoadConfigFiles (const ComponentConfig &config)
 
void LoadConfigFiles (const TimerComponentConfig &config)
 
- Protected 属性 继承自 apollo::cyber::ComponentBase
std::atomic< bool > is_shutdown_ = {false}
 
std::shared_ptr< Nodenode_ = nullptr
 
std::string config_file_path_ = ""
 
std::vector< std::shared_ptr< ReaderBase > > readers_
 

详细描述

在文件 prediction_component.h41 行定义.

构造及析构函数说明

◆ ~PredictionComponent()

apollo::prediction::PredictionComponent::~PredictionComponent ( )

Destructor

在文件 prediction_component.cc45 行定义.

45{}

成员函数说明

◆ Init()

bool apollo::prediction::PredictionComponent::Init ( )
overridevirtual

Initialize the node

返回
If initialized

实现了 apollo::cyber::ComponentBase.

在文件 prediction_component.cc70 行定义.

70 {
71 component_start_time_ = Clock::NowInSeconds();
72
73 container_manager_ = std::make_shared<ContainerManager>();
74 evaluator_manager_.reset(new EvaluatorManager());
75 predictor_manager_.reset(new PredictorManager());
76 scenario_manager_.reset(new ScenarioManager());
77
78 PredictionConf prediction_conf;
79 if (!ComponentBase::GetProtoConfig(&prediction_conf)) {
80 AERROR << "Unable to load prediction conf file: "
81 << ComponentBase::ConfigFilePath();
82 return false;
83 }
84 ADEBUG << "Prediction config file is loaded into: "
85 << prediction_conf.ShortDebugString();
86
87 if (!MessageProcess::Init(container_manager_.get(), evaluator_manager_.get(),
88 predictor_manager_.get(), prediction_conf)) {
89 return false;
90 }
91
92 planning_reader_ = node_->CreateReader<ADCTrajectory>(
93 prediction_conf.topic_conf().planning_trajectory_topic(), nullptr);
94
95 localization_reader_ =
96 node_->CreateReader<localization::LocalizationEstimate>(
97 prediction_conf.topic_conf().localization_topic(), nullptr);
98
99 storytelling_reader_ = node_->CreateReader<storytelling::Stories>(
100 prediction_conf.topic_conf().storytelling_topic(), nullptr);
101
102 prediction_writer_ = node_->CreateWriter<PredictionObstacles>(
103 prediction_conf.topic_conf().prediction_topic());
104
105 container_writer_ = node_->CreateWriter<SubmoduleOutput>(
106 prediction_conf.topic_conf().container_topic_name());
107
108 adc_container_writer_ = node_->CreateWriter<ADCTrajectoryContainer>(
109 prediction_conf.topic_conf().adccontainer_topic_name());
110
111 perception_obstacles_writer_ = node_->CreateWriter<PerceptionObstacles>(
112 prediction_conf.topic_conf().perception_obstacles_topic_name());
113
114 return true;
115}
static double NowInSeconds()
gets the current time in second.
Definition clock.cc:56
std::shared_ptr< Node > node_
static bool Init(ContainerManager *container_manager, EvaluatorManager *evaluator_manager, PredictorManager *predictor_manager, const PredictionConf &prediction_conf)
#define ADEBUG
Definition log.h:41
#define AERROR
Definition log.h:44

◆ Name()

std::string apollo::prediction::PredictionComponent::Name ( ) const

Get name of the node

返回
Name of the node

在文件 prediction_component.cc47 行定义.

47 {
48 return FLAGS_prediction_module_name;
49}

◆ OfflineProcessFeatureProtoFile()

void apollo::prediction::PredictionComponent::OfflineProcessFeatureProtoFile ( const std::string &  features_proto_file)

Load and process feature proto file.

参数
abin file including a sequence of feature proto.

在文件 prediction_component.cc51 行定义.

52 {
53 auto obstacles_container_ptr =
54 container_manager_->GetContainer<ObstaclesContainer>(
56 obstacles_container_ptr->Clear();
57 Features features;
58 apollo::cyber::common::GetProtoFromBinaryFile(features_proto_file_name,
59 &features);
60 for (const Feature& feature : features.feature()) {
61 obstacles_container_ptr->InsertFeatureProto(feature);
62 Obstacle* obstacle_ptr = obstacles_container_ptr->GetObstacle(feature.id());
63 if (!obstacle_ptr) {
64 continue;
65 }
66 evaluator_manager_->EvaluateObstacle(obstacle_ptr, obstacles_container_ptr);
67 }
68}
bool GetProtoFromBinaryFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as binary representation of protobufs,...
Definition file.cc:118

◆ Proc()

bool apollo::prediction::PredictionComponent::Proc ( const std::shared_ptr< perception::PerceptionObstacles > &  )
override

Data callback upon receiving a perception obstacle message.

参数
Perceptionobstacle message.

在文件 prediction_component.cc117 行定义.

118 {
119 if (FLAGS_use_lego) {
120 return ContainerSubmoduleProcess(perception_obstacles);
121 }
122 return PredictionEndToEndProc(perception_obstacles);
123}

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