Apollo 10.0
自动驾驶开放平台
TimerComponentSample类 参考

#include <timer_component_example.h>

类 TimerComponentSample 继承关系图:
TimerComponentSample 的协作图:

Public 成员函数

bool Init () override
 
bool Proc () override
 The Proc logic of the component, which called by the CyberRT frame.
 
- Public 成员函数 继承自 apollo::cyber::TimerComponent
 TimerComponent ()
 
 ~TimerComponent () override
 
bool Initialize (const TimerComponentConfig &config) override
 init the component by protobuf object.
 
void Clear () override
 
bool Process ()
 
uint32_t GetInterval () const
 
- Public 成员函数 继承自 apollo::cyber::ComponentBase
virtual ~ComponentBase ()
 
virtual bool Initialize (const ComponentConfig &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
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_
 

详细描述

在文件 timer_component_example.h29 行定义.

成员函数说明

◆ Init()

bool TimerComponentSample::Init ( )
overridevirtual

实现了 apollo::cyber::ComponentBase.

在文件 timer_component_example.cc23 行定义.

23 {
24 driver_writer_ = node_->CreateWriter<Driver>("/carstatus/channel");
25 return true;
26}
std::shared_ptr< Node > node_

◆ Proc()

bool TimerComponentSample::Proc ( )
overridevirtual

The Proc logic of the component, which called by the CyberRT frame.

返回
returns true if successful, otherwise returns false

实现了 apollo::cyber::TimerComponent.

在文件 timer_component_example.cc28 行定义.

28 {
29 static int i = 0;
30 auto out_msg = std::make_shared<Driver>();
31 out_msg->set_msg_id(i++);
32 driver_writer_->Write(out_msg);
33 AINFO << "timer_component_example: Write drivermsg->"
34 << out_msg->ShortDebugString();
35 return true;
36}
#define AINFO
Definition log.h:42

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