65 {
67 AERROR <<
"Task type is not cycle_routing.";
68 return false;
69 }
70
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() ==
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}
optional apollo::localization::Pose pose
optional apollo::common::Header header