Apollo  6.0
Open source self driving car software
spline_2d.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 
22 #pragma once
23 
24 #include <utility>
25 #include <vector>
26 
27 #include "Eigen/Core"
30 
31 namespace apollo {
32 namespace planning {
33 
34 class Spline2d {
35  public:
36  Spline2d(const std::vector<double>& t_knots, const uint32_t order);
37  std::pair<double, double> operator()(const double t) const;
38  double x(const double t) const;
39  double y(const double t) const;
40  double DerivativeX(const double t) const;
41  double DerivativeY(const double t) const;
42  double SecondDerivativeX(const double t) const;
43  double SecondDerivativeY(const double t) const;
44  double ThirdDerivativeX(const double t) const;
45  double ThirdDerivativeY(const double t) const;
46  bool set_splines(const Eigen::MatrixXd& params, const uint32_t order);
47  const Spline2dSeg& smoothing_spline(const uint32_t index) const;
48  const std::vector<double>& t_knots() const;
49  uint32_t spline_order() const;
50 
51  private:
52  uint32_t find_index(const double x) const;
53 
54  private:
55  std::vector<Spline2dSeg> splines_;
56  std::vector<double> t_knots_;
57  uint32_t spline_order_;
58 };
59 
60 } // namespace planning
61 } // namespace apollo
double DerivativeY(const double t) const
Definition: spline_2d.h:34
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
uint32_t spline_order() const
std::pair< double, double > operator()(const double t) const
Planning module main class. It processes GPS and IMU as input, to generate planning info...
bool set_splines(const Eigen::MatrixXd &params, const uint32_t order)
Spline2d(const std::vector< double > &t_knots, const uint32_t order)
double x(const double t) const
double DerivativeX(const double t) const
double SecondDerivativeY(const double t) const
const Spline2dSeg & smoothing_spline(const uint32_t index) const
double ThirdDerivativeY(const double t) const
double ThirdDerivativeX(const double t) const
Definition: spline_2d_seg.h:31
const std::vector< double > & t_knots() const
double y(const double t) const
double SecondDerivativeX(const double t) const