Apollo  6.0
Open source self driving car software
on_lane_planning.h
Go to the documentation of this file.
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 
26 
31 namespace apollo {
32 namespace planning {
33 
40 class OnLanePlanning : public PlanningBase {
41  public:
42  explicit OnLanePlanning(const std::shared_ptr<DependencyInjector>& injector)
43  : PlanningBase(injector) {
44  planner_dispatcher_ = std::make_unique<OnLanePlannerDispatcher>();
45  }
46  virtual ~OnLanePlanning();
47 
51  std::string Name() const override;
52 
57  common::Status Init(const PlanningConfig& config) override;
58 
63  void RunOnce(const LocalView& local_view,
64  ADCTrajectory* const ptr_trajectory_pb) override;
65 
67  const double current_time_stamp,
68  const std::vector<common::TrajectoryPoint>& stitching_trajectory,
69  ADCTrajectory* const trajectory) override;
70 
71  private:
72  common::Status InitFrame(const uint32_t sequence_num,
73  const common::TrajectoryPoint& planning_start_point,
74  const common::VehicleState& vehicle_state);
75 
76  common::VehicleState AlignTimeStamp(const common::VehicleState& vehicle_state,
77  const double curr_timestamp) const;
78 
79  void ExportReferenceLineDebug(planning_internal::Debug* debug);
80  bool CheckPlanningConfig(const PlanningConfig& config);
81  void GenerateStopTrajectory(ADCTrajectory* ptr_trajectory_pb);
82  void ExportFailedLaneChangeSTChart(const planning_internal::Debug& debug_info,
83  planning_internal::Debug* debug_chart);
84  void ExportOnLaneChart(const planning_internal::Debug& debug_info,
85  planning_internal::Debug* debug_chart);
86  void ExportOpenSpaceChart(const planning_internal::Debug& debug_info,
87  const ADCTrajectory& trajectory_pb,
88  planning_internal::Debug* debug_chart);
89  void AddOpenSpaceOptimizerResult(const planning_internal::Debug& debug_info,
90  planning_internal::Debug* debug_chart);
91  void AddPartitionedTrajectory(const planning_internal::Debug& debug_info,
92  planning_internal::Debug* debug_chart);
93 
94  void AddStitchSpeedProfile(planning_internal::Debug* debug_chart);
95 
96  void AddPublishedSpeed(const ADCTrajectory& trajectory_pb,
97  planning_internal::Debug* debug_chart);
98 
99  void AddPublishedAcceleration(const ADCTrajectory& trajectory_pb,
100  planning_internal::Debug* debug);
101 
102  void AddFallbackTrajectory(const planning_internal::Debug& debug_info,
103  planning_internal::Debug* debug_chart);
104 
105  private:
106  routing::RoutingResponse last_routing_;
107  std::unique_ptr<ReferenceLineProvider> reference_line_provider_;
108  Smoother planning_smoother_;
109 };
110 
111 } // namespace planning
112 } // namespace apollo
Definition: planning_base.h:54
std::unique_ptr< PlannerDispatcher > planner_dispatcher_
Definition: planning_base.h:92
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
void RunOnce(const LocalView &local_view, ADCTrajectory *const ptr_trajectory_pb) override
main logic of the planning module, runs periodically triggered by timer.
common::Status Init(const PlanningConfig &config) override
module initialization function
Planning module main class. It processes GPS and IMU as input, to generate planning info...
LocalView contains all necessary data as planning input.
std::string Name() const override
Planning name.
OnLanePlanning(const std::shared_ptr< DependencyInjector > &injector)
Definition: on_lane_planning.h:42
Definition: smoother.h:31
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
Definition: on_lane_planning.h:40
Definition: local_view.h:38
common::Status Plan(const double current_time_stamp, const std::vector< common::TrajectoryPoint > &stitching_trajectory, ADCTrajectory *const trajectory) override
Plan the trajectory given current vehicle state.