Apollo 10.0
自动驾驶开放平台
apollo::control::PreprocessorSubmodule类 参考final

#include <preprocessor_submodule.h>

类 apollo::control::PreprocessorSubmodule 继承关系图:
apollo::control::PreprocessorSubmodule 的协作图:

Public 成员函数

 PreprocessorSubmodule ()
 Construct a new Preprocessor Submodule object
 
 ~PreprocessorSubmodule ()
 Destructor
 
std::string Name () const
 Get name of the node
 
bool Init () override
 Initialize the submodule
 
bool Proc (const std::shared_ptr< LocalView > &local_view) override
 
- Public 成员函数 继承自 apollo::cyber::Component< LocalView >
 Component ()
 
 ~Component () override
 
bool Initialize (const ComponentConfig &config) override
 init the component by protobuf object.
 
bool Process (const std::shared_ptr< LocalView > &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_
 

详细描述

在文件 preprocessor_submodule.h40 行定义.

构造及析构函数说明

◆ PreprocessorSubmodule()

apollo::control::PreprocessorSubmodule::PreprocessorSubmodule ( )

Construct a new Preprocessor Submodule object

在文件 preprocessor_submodule.cc42 行定义.

◆ ~PreprocessorSubmodule()

apollo::control::PreprocessorSubmodule::~PreprocessorSubmodule ( )

Destructor

在文件 preprocessor_submodule.cc45 行定义.

45{}

成员函数说明

◆ Init()

bool apollo::control::PreprocessorSubmodule::Init ( )
overridevirtual

Initialize the submodule

返回
If initialized

实现了 apollo::cyber::ComponentBase.

在文件 preprocessor_submodule.cc51 行定义.

51 {
52 injector_ = std::make_shared<DependencyInjector>();
53
54 // Preprocessor writer
55 preprocessor_writer_ =
56 node_->CreateWriter<Preprocessor>(FLAGS_control_preprocessor_topic);
57
58 ACHECK(preprocessor_writer_ != nullptr);
59 return true;
60}
std::shared_ptr< Node > node_
#define ACHECK(cond)
Definition log.h:80

◆ Name()

std::string apollo::control::PreprocessorSubmodule::Name ( ) const

Get name of the node

返回
Name of the node

在文件 preprocessor_submodule.cc47 行定义.

47 {
48 return FLAGS_preprocessor_submodule_name;
49}

◆ Proc()

bool apollo::control::PreprocessorSubmodule::Proc ( const std::shared_ptr< LocalView > &  local_view)
override

在文件 preprocessor_submodule.cc62 行定义.

62 {
63 ADEBUG << "Preprocessor started ....";
64 const auto start_time = Clock::Now();
65
66 Preprocessor control_preprocessor;
67 // handling estop
68 auto *preprocessor_status =
69 control_preprocessor.mutable_header()->mutable_status();
70
71 control_preprocessor.mutable_local_view()->CopyFrom(*local_view);
72
73 Status status = ProducePreprocessorStatus(&control_preprocessor);
74 AERROR_IF(!status.ok()) << "Failed to produce control preprocessor:"
75 << status.error_message();
76
77 if (status.ok() && !estop_) {
78 preprocessor_status->set_error_code(ErrorCode::OK);
79 } else {
80 estop_ = true;
81 preprocessor_status->set_error_code(status.code());
82 preprocessor_status->set_msg(status.error_message());
83 }
84
85 if (control_preprocessor.local_view().has_pad_msg()) {
86 const auto &pad_message = control_preprocessor.local_view().pad_msg();
87 if (pad_message.action() == DrivingAction::RESET) {
88 AINFO << "Control received RESET action!";
89 estop_ = false;
90 preprocessor_status->set_error_code(ErrorCode::OK);
91 preprocessor_status->set_msg("");
92 }
93 control_preprocessor.set_received_pad_msg(true);
94 }
95
96 control_preprocessor.mutable_header()->set_lidar_timestamp(
97 local_view->header().lidar_timestamp());
98 control_preprocessor.mutable_header()->set_camera_timestamp(
99 local_view->trajectory().header().camera_timestamp());
100 control_preprocessor.mutable_header()->set_radar_timestamp(
101 local_view->trajectory().header().radar_timestamp());
102 common::util::FillHeader(Name(), &control_preprocessor);
103
104 const auto end_time = Clock::Now();
105
106 static apollo::common::LatencyRecorder latency_recorder(
107 FLAGS_control_preprocessor_topic);
108 latency_recorder.AppendLatencyRecord(
109 control_preprocessor.header().lidar_timestamp(), start_time, end_time);
110
111 preprocessor_writer_->Write(control_preprocessor);
112 ADEBUG << "Preprocessor finished.";
113
114 return true;
115}
std::string Name() const
Get name of the node
static Time Now()
PRECISION >= 1000000 means the precision is at least 1us.
Definition clock.cc:40
#define ADEBUG
Definition log.h:41
#define AERROR_IF(cond)
Definition log.h:74
#define AINFO
Definition log.h:42
LocalView contains all necessary data as planning input

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