Apollo 10.0
自动驾驶开放平台
planning_base.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#include <string>
21#include <vector>
22
23#include "modules/common_msgs/basic_msgs/pnc_point.pb.h"
24#include "modules/common_msgs/chassis_msgs/chassis.pb.h"
25#include "modules/common_msgs/dreamview_msgs/chart.pb.h"
26#include "modules/common_msgs/localization_msgs/localization.pb.h"
27#include "modules/common_msgs/perception_msgs/traffic_light_detection.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/routing_msgs/routing.pb.h"
31#include "modules/planning/planning_base/proto/planning_config.pb.h"
32
36
41namespace apollo {
42namespace planning {
43
44class Planner;
45class Frame;
46class PublishableTrajectory;
47class DependencyInjector;
48class HDMap;
49class LocalView;
50
59 public:
60 PlanningBase() = delete;
61
62 explicit PlanningBase(const std::shared_ptr<DependencyInjector>& injector);
63
64 virtual ~PlanningBase();
65
66 virtual apollo::common::Status Init(const PlanningConfig& config);
67
68 virtual std::string Name() const = 0;
69
70 virtual void RunOnce(const LocalView& local_view,
71 ADCTrajectory* const adc_trajectory) = 0;
72
77 const double current_time_stamp,
78 const std::vector<common::TrajectoryPoint>& stitching_trajectory,
79 ADCTrajectory* const trajectory) = 0;
80
87 const ADCTrajectory::TrajectoryType& current_trajectory_type) const;
88
89 bool GenerateWidthOfLane(const Vec2d& current_location, Vec2d& left_point,
90 Vec2d& right_point);
91
92 protected:
93 virtual void FillPlanningPb(const double timestamp,
94 ADCTrajectory* const trajectory_pb);
95
96 void LoadPlanner();
97
99 const hdmap::HDMap* hdmap_ = nullptr;
100
101 double start_time_ = 0.0;
102 size_t seq_num_ = 0;
103
106 std::unique_ptr<Frame> frame_;
107 std::shared_ptr<Planner> planner_;
108 std::unique_ptr<PublishableTrajectory> last_publishable_trajectory_;
109 std::shared_ptr<DependencyInjector> injector_;
110};
111
112} // namespace planning
113} // namespace apollo
A general class to denote the return status of an API call.
Definition status.h:43
Implements a class of 2-dimensional vectors.
Definition vec2d.h:42
High-precision map loader interface.
Definition hdmap.h:54
virtual apollo::common::Status Init(const PlanningConfig &config)
std::unique_ptr< Frame > frame_
virtual void FillPlanningPb(const double timestamp, ADCTrajectory *const trajectory_pb)
bool GenerateWidthOfLane(const Vec2d &current_location, Vec2d &left_point, Vec2d &right_point)
std::unique_ptr< PublishableTrajectory > last_publishable_trajectory_
bool IsPlanningFinished(const ADCTrajectory::TrajectoryType &current_trajectory_type) const
Check if vehicle reaches the end point of the RoutingRequest.
const hdmap::HDMap * hdmap_
virtual void RunOnce(const LocalView &local_view, ADCTrajectory *const adc_trajectory)=0
virtual apollo::common::Status Plan(const double current_time_stamp, const std::vector< common::TrajectoryPoint > &stitching_trajectory, ADCTrajectory *const trajectory)=0
Plan the trajectory given current vehicle state
std::shared_ptr< Planner > planner_
virtual std::string Name() const =0
std::shared_ptr< DependencyInjector > injector_
Create traffic related decision in this class.
Planning module main class.
class register implement
Definition arena_queue.h:37
LocalView contains all necessary data as planning input
Defines the Vec2d class.