Apollo  6.0
Open source self driving car software
piecewise_jerk_speed_nonlinear_optimizer.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2019 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 
21 #pragma once
22 
23 #include <utility>
24 #include <vector>
25 
28 
29 namespace apollo {
30 namespace planning {
31 
33  public:
34  explicit PiecewiseJerkSpeedNonlinearOptimizer(const TaskConfig& config);
35 
36  virtual ~PiecewiseJerkSpeedNonlinearOptimizer() = default;
37 
38  private:
39  common::Status Process(const PathData& path_data,
40  const common::TrajectoryPoint& init_point,
41  SpeedData* const speed_data) override;
42 
43  common::Status SetUpStatesAndBounds(const PathData& path_data,
44  const SpeedData& speed_data);
45 
46  bool CheckSpeedLimitFeasibility();
47 
48  common::Status SmoothSpeedLimit();
49 
50  common::Status SmoothPathCurvature(const PathData& path_data);
51 
52  common::Status OptimizeByQP(SpeedData* const speed_data,
53  std::vector<double>* distance,
54  std::vector<double>* velocity,
55  std::vector<double>* acceleration);
56 
57  common::Status OptimizeByNLP(std::vector<double>* distance,
58  std::vector<double>* velocity,
59  std::vector<double>* acceleration);
60 
61  // st problem dimensions
62  double delta_t_ = 0.0;
63  double total_length_ = 0.0;
64  double total_time_ = 0.0;
65  int num_of_knots_ = 0;
66 
67  // st initial values
68  double s_init_ = 0.0;
69  double s_dot_init_ = 0.0;
70  double s_ddot_init_ = 0.0;
71 
72  // st states dynamically feasibility bounds
73  double s_dot_max_ = 0.0;
74  double s_ddot_min_ = 0.0;
75  double s_ddot_max_ = 0.0;
76  double s_dddot_min_ = 0.0;
77  double s_dddot_max_ = 0.0;
78 
79  // st safety bounds
80  std::vector<std::pair<double, double>> s_bounds_;
81  std::vector<std::pair<double, double>> s_soft_bounds_;
82 
83  // speed limits
84  SpeedLimit speed_limit_;
85  PiecewiseJerkTrajectory1d smoothed_speed_limit_;
86 
87  // smoothed path curvature profile as a function of traversal distance
88  PiecewiseJerkTrajectory1d smoothed_path_curvature_;
89 
90  // reference speed profile
91  SpeedData reference_speed_data_;
92 
93  // reference cruise speed
94  double cruise_speed_;
95 };
96 
97 } // namespace planning
98 } // namespace apollo
Definition: speed_optimizer.h:31
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
PiecewiseJerkSpeedNonlinearOptimizer(const TaskConfig &config)
Planning module main class. It processes GPS and IMU as input, to generate planning info...
Definition: piecewise_jerk_trajectory1d.h:32
Definition: path_data.h:36
Definition: speed_limit.h:29
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: piecewise_jerk_speed_nonlinear_optimizer.h:32
Definition: speed_data.h:30