Apollo  6.0
Open source self driving car software
spline_1d.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 
29 #pragma once
30 
31 #include <vector>
32 
36 
37 namespace apollo {
38 namespace planning {
39 
40 class Spline1d {
41  public:
42  Spline1d(const std::vector<double>& x_knots, const uint32_t order);
43 
44  // @brief: given x return f(x) value, derivative, second order derivative and
45  // the third order;
46  double operator()(const double x) const;
47  double Derivative(const double x) const;
48  double SecondOrderDerivative(const double x) const;
49  double ThirdOrderDerivative(const double x) const;
50 
51  // @brief: set spline segments
52  bool SetSplineSegs(const Eigen::MatrixXd& param_matrix, const uint32_t order);
53 
54  const std::vector<double>& x_knots() const;
55  uint32_t spline_order() const;
56 
57  const std::vector<Spline1dSeg>& splines() const;
58 
59  private:
60  uint32_t FindIndex(const double x) const;
61 
62  private:
63  std::vector<Spline1dSeg> splines_;
64  std::vector<double> x_knots_;
65  uint32_t spline_order_;
66 };
67 
68 } // namespace planning
69 } // namespace apollo
const std::vector< Spline1dSeg > & splines() const
: polynomial smoothing spline
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
double SecondOrderDerivative(const double x) const
double ThirdOrderDerivative(const double x) const
bool SetSplineSegs(const Eigen::MatrixXd &param_matrix, const uint32_t order)
Planning module main class. It processes GPS and IMU as input, to generate planning info...
Spline1d(const std::vector< double > &x_knots, const uint32_t order)
double operator()(const double x) const
uint32_t spline_order() const
double Derivative(const double x) const
const std::vector< double > & x_knots() const
Definition: spline_1d.h:40