Apollo  6.0
Open source self driving car software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
spline_2d_kernel.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 
21 #pragma once
22 
23 #include <vector>
24 
25 #include "Eigen/Core"
28 
29 namespace apollo {
30 namespace planning {
31 
33  public:
34  Spline2dKernel(const std::vector<double>& t_knots,
35  const uint32_t spline_order);
36 
37  // customized input output
38  void AddRegularization(const double regularization_param);
39  bool AddKernel(const Eigen::MatrixXd& kernel, const Eigen::MatrixXd& offset,
40  const double weight);
41  bool AddKernel(const Eigen::MatrixXd& kernel, const double weight);
42 
43  Eigen::MatrixXd* mutable_kernel_matrix();
44  Eigen::MatrixXd* mutable_offset();
45 
46  Eigen::MatrixXd kernel_matrix() const;
47  const Eigen::MatrixXd offset() const;
48 
49  // build-in kernel methods
50  void AddDerivativeKernelMatrix(const double weight);
51  void AddSecondOrderDerivativeMatrix(const double weight);
52  void AddThirdOrderDerivativeMatrix(const double weight);
53 
54  // reference line kernel, x_coord in strictly increasing order
56  const std::vector<double>& t_coord,
57  const std::vector<common::math::Vec2d>& ref_points, const double weight);
58 
59  private:
60  void AddNthDerivativeKernelMatrix(const uint32_t n, const double weight);
61  uint32_t find_index(const double x) const;
62 
63  private:
64  Eigen::MatrixXd kernel_matrix_;
65  Eigen::MatrixXd offset_;
66  std::vector<double> t_knots_;
67  uint32_t spline_order_;
68  size_t total_params_;
69 };
70 
71 } // namespace planning
72 } // namespace apollo
bool AddReferenceLineKernelMatrix(const std::vector< double > &t_coord, const std::vector< common::math::Vec2d > &ref_points, const double weight)
: piecewise smoothing spline 2d class
Defines the Vec2d class.
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
bool AddKernel(const Eigen::MatrixXd &kernel, const Eigen::MatrixXd &offset, const double weight)
Planning module main class. It processes GPS and IMU as input, to generate planning info...
Eigen::MatrixXd kernel_matrix() const
Definition: spline_2d_kernel.h:32
Eigen::MatrixXd * mutable_kernel_matrix()
const Eigen::MatrixXd offset() const
Eigen::MatrixXd * mutable_offset()
void AddThirdOrderDerivativeMatrix(const double weight)
Spline2dKernel(const std::vector< double > &t_knots, const uint32_t spline_order)
void AddSecondOrderDerivativeMatrix(const double weight)
void AddRegularization(const double regularization_param)
void AddDerivativeKernelMatrix(const double weight)