Apollo  6.0
Open source self driving car software
planner.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2017 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 
22 #include "modules/common/proto/pnc_point.pb.h"
25 #include "modules/planning/proto/planning_config.pb.h"
28 
33 namespace apollo {
34 namespace planning {
35 
42 class Planner {
43  public:
47  Planner() = delete;
48 
49  explicit Planner(const std::shared_ptr<DependencyInjector>& injector)
50  : scenario_manager_(injector) {}
51 
55  virtual ~Planner() = default;
56 
57  virtual std::string Name() = 0;
58  virtual apollo::common::Status Init(const PlanningConfig& config) = 0;
59 
67  const common::TrajectoryPoint& planning_init_point, Frame* frame,
68  ADCTrajectory* ptr_computed_trajectory) = 0;
69 
70  virtual void Stop() = 0;
71 
72  protected:
73  PlanningConfig config_;
76 };
77 
79  public:
83  PlannerWithReferenceLine() = delete;
84 
86  const std::shared_ptr<DependencyInjector>& injector)
87  : Planner(injector) {}
88 
92  virtual ~PlannerWithReferenceLine() = default;
93 
102  const common::TrajectoryPoint& planning_init_point, Frame* frame,
103  ReferenceLineInfo* reference_line_info) {
104  CHECK_NOTNULL(frame);
106  }
107 };
108 
109 } // namespace planning
110 } // namespace apollo
virtual apollo::common::Status Plan(const common::TrajectoryPoint &planning_init_point, Frame *frame, ADCTrajectory *ptr_computed_trajectory)=0
Compute trajectories for execution.
scenario::Scenario * scenario_
Definition: planner.h:75
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
virtual std::string Name()=0
Planning module main class. It processes GPS and IMU as input, to generate planning info...
Frame holds all data for one planning cycle.
Definition: frame.h:61
ReferenceLineInfo holds all data for one reference line.
Definition: reference_line_info.h:54
PlannerWithReferenceLine(const std::shared_ptr< DependencyInjector > &injector)
Definition: planner.h:85
Planner is a base class for specific planners. It contains a pure virtual function Plan which must be...
Definition: planner.h:42
scenario::ScenarioManager scenario_manager_
Definition: planner.h:74
Planner(const std::shared_ptr< DependencyInjector > &injector)
Definition: planner.h:49
virtual ~Planner()=default
Destructor.
static Status OK()
generate a success status.
Definition: status.h:60
virtual void Stop()=0
Definition: scenario_manager.h:31
virtual apollo::common::Status PlanOnReferenceLine(const common::TrajectoryPoint &planning_init_point, Frame *frame, ReferenceLineInfo *reference_line_info)
Compute a trajectory for execution.
Definition: planner.h:101
A general class to denote the return status of an API call. It can either be an OK status for success...
Definition: status.h:43
Planner()=delete
Constructor.
Definition: scenario.h:41
virtual apollo::common::Status Init(const PlanningConfig &config)=0
PlanningConfig config_
Definition: planner.h:73