Apollo  6.0
Open source self driving car software
navi_planner.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 
22 #pragma once
23 
24 #include <memory>
25 #include <string>
26 #include <vector>
27 
28 #include "modules/common/proto/pnc_point.pb.h"
35 #include "modules/planning/proto/planning.pb.h"
36 #include "modules/planning/proto/planning_config.pb.h"
39 
44 namespace apollo {
45 namespace planning {
46 
57  public:
58  NaviPlanner() = delete;
59  explicit NaviPlanner(const std::shared_ptr<DependencyInjector>& injector)
60  : PlannerWithReferenceLine(injector) {}
61 
62  virtual ~NaviPlanner() = default;
63 
64  std::string Name() override { return "NAVI"; }
65 
66  common::Status Init(const PlanningConfig& config) override;
67 
74  common::Status Plan(const common::TrajectoryPoint& planning_init_point,
75  Frame* frame,
76  ADCTrajectory* ptr_computed_trajectory) override;
77 
78  void Stop() override {}
79 
88  const common::TrajectoryPoint& planning_init_point, Frame* frame,
89  ReferenceLineInfo* reference_line_info) override;
90 
91  private:
92  void RegisterTasks();
93  std::vector<common::SpeedPoint> GenerateInitSpeedProfile(
94  const common::TrajectoryPoint& planning_init_point,
95  const ReferenceLineInfo* reference_line_info);
96 
97  std::vector<common::SpeedPoint> DummyHotStart(
98  const common::TrajectoryPoint& planning_init_point);
99 
100  std::vector<common::SpeedPoint> GenerateSpeedHotStart(
101  const common::TrajectoryPoint& planning_init_point);
102 
103  void GenerateFallbackPathProfile(const ReferenceLineInfo* reference_line_info,
104  PathData* path_data);
105 
106  void GenerateFallbackSpeedProfile(SpeedData* speed_data);
107 
108  SpeedData GenerateStopProfile(const double init_speed,
109  const double init_acc) const;
110 
111  SpeedData GenerateStopProfileFromPolynomial(const double init_speed,
112  const double init_acc) const;
113 
114  bool IsValidProfile(const QuinticPolynomialCurve1d& curve) const;
115 
116  void RecordObstacleDebugInfo(ReferenceLineInfo* reference_line_info);
117 
118  void RecordDebugInfo(ReferenceLineInfo* reference_line_info,
119  const std::string& name, const double time_diff_ms);
120 
121  private:
123  std::vector<std::unique_ptr<NaviTask>> tasks_;
124 };
125 
126 } // namespace planning
127 } // namespace apollo
std::string Name() override
Definition: navi_planner.h:64
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
common::Status PlanOnReferenceLine(const common::TrajectoryPoint &planning_init_point, Frame *frame, ReferenceLineInfo *reference_line_info) override
Override function Plan in parent class Planner.
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
void Stop() override
Definition: navi_planner.h:78
Definition: quintic_polynomial_curve1d.h:33
Implements a Factory design pattern with Register and Create methods.
Definition: factory.h:60
NaviPlanner is a planner based on real-time relative maps. It uses the vehicle&#39;s FLU (Front-Left-Up) ...
Definition: navi_planner.h:56
Definition: path_data.h:36
NaviPlanner(const std::shared_ptr< DependencyInjector > &injector)
Definition: navi_planner.h:59
Defines the Factory class.
common::Status Init(const PlanningConfig &config) override
virtual ~NaviPlanner()=default
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
common::Status Plan(const common::TrajectoryPoint &planning_init_point, Frame *frame, ADCTrajectory *ptr_computed_trajectory) override
Override function Plan in parent class Planner.
Definition: speed_data.h:30