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

#include <task_manager_component.h>

类 apollo::task_manager::TaskManagerComponent 继承关系图:
apollo::task_manager::TaskManagerComponent 的协作图:

Public 成员函数

 TaskManagerComponent ()=default
 
 ~TaskManagerComponent ()=default
 
bool Init () override
 
bool Proc (const std::shared_ptr< task_manager::Task > &task) override
 
- Public 成员函数 继承自 apollo::cyber::Component< task_manager::Task >
 Component ()
 
 ~Component () override
 
bool Initialize (const ComponentConfig &config) override
 init the component by protobuf object.
 
bool Process (const std::shared_ptr< task_manager::Task > &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_
 

详细描述

在文件 task_manager_component.h37 行定义.

构造及析构函数说明

◆ TaskManagerComponent()

apollo::task_manager::TaskManagerComponent::TaskManagerComponent ( )
default

◆ ~TaskManagerComponent()

apollo::task_manager::TaskManagerComponent::~TaskManagerComponent ( )
default

成员函数说明

◆ Init()

bool apollo::task_manager::TaskManagerComponent::Init ( )
overridevirtual

实现了 apollo::cyber::ComponentBase.

在文件 task_manager_component.cc34 行定义.

34 {
35 TaskManagerConfig task_manager_conf;
37 << "Unable to load task_manager conf file: "
39
40 AINFO << "Config file: " << cyber::ComponentBase::ConfigFilePath()
41 << " is loaded.";
42
43 localization_reader_ = node_->CreateReader<LocalizationEstimate>(
44 task_manager_conf.topic_config().localization_pose_topic(),
45 [this](const std::shared_ptr<LocalizationEstimate>& localization) {
46 ADEBUG << "Received localization data: run localization callback.";
47 std::lock_guard<std::mutex> lock(mutex_);
48 localization_.CopyFrom(*localization);
49 });
50
51 planning_command_reader_ = node_->CreateReader<PlanningCommand>(
52 task_manager_conf.topic_config().planning_command_topic(),
53 [this](const std::shared_ptr<PlanningCommand>& planning_command) {
54 ADEBUG << "Received planning_command: run response callback.";
55 std::lock_guard<std::mutex> lock(mutex_);
56 planning_command_.CopyFrom(*planning_command);
57 });
58
59 lane_follow_command_client_ =
60 node_->CreateClient<LaneFollowCommand, CommandStatus>(
61 task_manager_conf.topic_config().lane_follow_command_topic());
62 return true;
63}
bool GetProtoConfig(T *config) const
const std::string & ConfigFilePath() const
std::shared_ptr< Node > node_
#define ACHECK(cond)
Definition log.h:80
#define ADEBUG
Definition log.h:41
#define AINFO
Definition log.h:42

◆ Proc()

bool apollo::task_manager::TaskManagerComponent::Proc ( const std::shared_ptr< task_manager::Task > &  task)
override

在文件 task_manager_component.cc65 行定义.

65 {
66 if (task->task_type() != CYCLE_ROUTING) {
67 AERROR << "Task type is not cycle_routing.";
68 return false;
69 }
70
71 if (task->task_type() == CYCLE_ROUTING) {
72 cycle_routing_manager_ = std::make_shared<CycleRoutingManager>();
73 cycle_routing_manager_->Init(task->cycle_routing_task());
74 lane_follow_command_ = task->cycle_routing_task().lane_follow_command();
75 Rate rate(1.0);
76
77 while (cycle_routing_manager_->GetCycle() > 0) {
78 if (cycle_routing_manager_->GetNewRouting(localization_.pose(),
79 &lane_follow_command_)) {
80 auto last_planning_command_ = planning_command_;
81 common::util::FillHeader(node_->Name(), &lane_follow_command_);
82 auto lane_follow_command = std::make_shared<LaneFollowCommand>();
83 lane_follow_command->CopyFrom(lane_follow_command_);
84 lane_follow_command_client_->SendRequest(lane_follow_command);
85 AINFO << "[TaskManagerComponent]Reach begin/end point: "
86 << "routing manager send a routing request. ";
87 rate.Sleep();
88
89 if (!planning_command_.has_header()) {
90 AINFO << "[TaskManagerComponent]routing failed";
91 return false;
92 }
93 if (last_planning_command_.has_header()) {
94 if (last_planning_command_.header().sequence_num() ==
95 planning_command_.header().sequence_num()) {
96 AINFO << "[TaskManagerComponent]No routing response: "
97 << "new routing failed";
98 return false;
99 }
100 }
101 }
102 rate.Sleep();
103 }
104 }
105 return true;
106}
#define AERROR
Definition log.h:44
optional uint32 sequence_num
Definition header.proto:16
optional apollo::localization::Pose pose
optional apollo::common::Header header

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