Apollo  6.0
Open source self driving car software
spiral_reference_line_smoother.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 /*
18  * spiral_reference_line_smoother.h
19  */
20 
21 #pragma once
22 
23 #include <vector>
24 
25 #include "Eigen/Dense"
26 #include "modules/planning/proto/planning.pb.h"
30 
31 namespace apollo {
32 namespace planning {
33 
35  public:
37  const ReferenceLineSmootherConfig& config);
38 
39  virtual ~SpiralReferenceLineSmoother() = default;
40 
41  bool Smooth(const ReferenceLine& raw_reference_line,
42  ReferenceLine* const smoothed_reference_line) override;
43 
44  // For offline navigation line smoothing
45  int SmoothStandAlone(std::vector<Eigen::Vector2d> point2d,
46  std::vector<double>* ptr_theta,
47  std::vector<double>* ptr_kappa,
48  std::vector<double>* ptr_dkappa,
49  std::vector<double>* ptr_s, std::vector<double>* ptr_x,
50  std::vector<double>* ptr_y) const;
51 
52  void SetAnchorPoints(const std::vector<AnchorPoint>&) override;
53 
54  std::vector<common::PathPoint> Interpolate(const std::vector<double>& theta,
55  const std::vector<double>& kappa,
56  const std::vector<double>& dkappa,
57  const std::vector<double>& s,
58  const std::vector<double>& x,
59  const std::vector<double>& y,
60  const double resolution) const;
61 
62  private:
63  bool Smooth(std::vector<Eigen::Vector2d> point2d,
64  std::vector<double>* ptr_theta, std::vector<double>* ptr_kappa,
65  std::vector<double>* ptr_dkappa, std::vector<double>* ptr_s,
66  std::vector<double>* ptr_x, std::vector<double>* ptr_y) const;
67 
68  private:
69  std::vector<common::PathPoint> Interpolate(
70  const double start_x, const double start_y, const double start_s,
71  const double theta0, const double kappa0, const double dkappa0,
72  const double theta1, const double kappa1, const double dkappa1,
73  const double delta_s, const double resolution) const;
74 
75  common::PathPoint to_path_point(const double x, const double y,
76  const double s, const double theta,
77  const double kappa,
78  const double dkappa) const;
79 
80  std::vector<AnchorPoint> anchor_points_;
81 
82  bool fixed_start_point_ = false;
83 
84  double fixed_start_x_ = 0.0;
85 
86  double fixed_start_y_ = 0.0;
87 
88  double fixed_start_theta_ = 0.0;
89 
90  double fixed_start_kappa_ = 0.0;
91 
92  double fixed_start_dkappa_ = 0.0;
93 
94  double fixed_end_x_ = 0.0;
95 
96  double fixed_end_y_ = 0.0;
97 
98  double zero_x_ = 0.0;
99 
100  double zero_y_ = 0.0;
101 };
102 
103 } // namespace planning
104 } // namespace apollo
void SetAnchorPoints(const std::vector< AnchorPoint > &) override
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::vector< common::PathPoint > Interpolate(const std::vector< double > &theta, const std::vector< double > &kappa, const std::vector< double > &dkappa, const std::vector< double > &s, const std::vector< double > &x, const std::vector< double > &y, const double resolution) const
Planning module main class. It processes GPS and IMU as input, to generate planning info...
bool Smooth(const ReferenceLine &raw_reference_line, ReferenceLine *const smoothed_reference_line) override
SpiralReferenceLineSmoother(const ReferenceLineSmootherConfig &config)
int SmoothStandAlone(std::vector< Eigen::Vector2d > point2d, std::vector< double > *ptr_theta, std::vector< double > *ptr_kappa, std::vector< double > *ptr_dkappa, std::vector< double > *ptr_s, std::vector< double > *ptr_x, std::vector< double > *ptr_y) const
Definition: reference_line.h:39
Definition: reference_line_smoother.h:39
Definition: spiral_reference_line_smoother.h:34