Apollo 10.0
自动驾驶开放平台
planning_component.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#pragma once
18
19#include <memory>
20
21#include "modules/common_msgs/chassis_msgs/chassis.pb.h"
22#include "modules/common_msgs/control_msgs/control_interactive_msg.pb.h"
23#include "modules/common_msgs/external_command_msgs/command_status.pb.h"
24#include "modules/common_msgs/external_command_msgs/lane_follow_command.pb.h"
25#include "modules/common_msgs/localization_msgs/localization.pb.h"
26#include "modules/common_msgs/perception_msgs/traffic_light_detection.pb.h"
27#include "modules/common_msgs/planning_msgs/pad_msg.pb.h"
28#include "modules/common_msgs/planning_msgs/planning.pb.h"
29#include "modules/common_msgs/prediction_msgs/prediction_obstacle.pb.h"
30#include "modules/common_msgs/storytelling_msgs/story.pb.h"
31#include "modules/planning/planning_base/proto/learning_data.pb.h"
32#include "modules/planning/planning_base/proto/planning_config.pb.h"
33
40
41namespace apollo {
42namespace planning {
43
45 : public cyber::Component<prediction::PredictionObstacles, canbus::Chassis,
46 localization::LocalizationEstimate> {
47 public:
48 PlanningComponent() = default;
49
50 ~PlanningComponent() = default;
51
52 public:
53 bool Init() override;
54
55 bool Proc(const std::shared_ptr<prediction::PredictionObstacles>&
56 prediction_obstacles,
57 const std::shared_ptr<canbus::Chassis>& chassis,
58 const std::shared_ptr<localization::LocalizationEstimate>&
59 localization_estimate) override;
60
61 private:
62 void CheckRerouting();
63 bool CheckInput();
64 void SetLocation(ADCTrajectory* const ptr_trajectory_pb);
65
66 private:
67 std::shared_ptr<cyber::Reader<perception::TrafficLightDetection>>
68 traffic_light_reader_;
69 std::shared_ptr<
72 rerouting_client_;
73 std::shared_ptr<cyber::Reader<planning::PadMessage>> pad_msg_reader_;
74 std::shared_ptr<cyber::Reader<relative_map::MapMsg>> relative_map_reader_;
75 std::shared_ptr<cyber::Reader<storytelling::Stories>> story_telling_reader_;
76 std::shared_ptr<cyber::Reader<PlanningCommand>> planning_command_reader_;
77 std::shared_ptr<cyber::Reader<control::ControlInteractiveMsg>>
78 control_interactive_reader_;
79
80 std::shared_ptr<cyber::Writer<ADCTrajectory>> planning_writer_;
81 std::shared_ptr<cyber::Writer<routing::RoutingRequest>> rerouting_writer_;
82 std::shared_ptr<cyber::Writer<PlanningLearningData>>
83 planning_learning_data_writer_;
84 std::shared_ptr<cyber::Writer<external_command::CommandStatus>>
85 command_status_writer_;
86
87 std::mutex mutex_;
90 planning::PadMessage pad_msg_;
91 relative_map::MapMsg relative_map_;
92 storytelling::Stories stories_;
93 PlanningCommand planning_command_;
94 control::ControlInteractiveMsg control_interactive_msg_;
95 LocalView local_view_;
96
97 std::unique_ptr<PlanningBase> planning_base_;
98 std::shared_ptr<DependencyInjector> injector_;
99
100 PlanningConfig config_;
101 MessageProcess message_process_;
102};
103
105
106} // namespace planning
107} // namespace apollo
Client get Response from a responding Service by sending a Request
Definition client.h:47
bool Proc(const std::shared_ptr< prediction::PredictionObstacles > &prediction_obstacles, const std::shared_ptr< canbus::Chassis > &chassis, const std::shared_ptr< localization::LocalizationEstimate > &localization_estimate) override
Planning module main class.
#define CYBER_REGISTER_COMPONENT(name)
Definition component.h:656
class register implement
Definition arena_queue.h:37