Apollo  6.0
Open source self driving car software
spline_2d_seg.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 <utility>
24 #include <vector>
25 
27 
28 namespace apollo {
29 namespace planning {
30 
31 class Spline2dSeg {
32  public:
33  // order represent the number of parameters (not the highest order);
34  explicit Spline2dSeg(const uint32_t order);
35  Spline2dSeg(const std::vector<double>& x_param,
36  const std::vector<double>& y_param);
37  ~Spline2dSeg() = default;
38 
39  bool SetParams(const std::vector<double>& x_param,
40  const std::vector<double>& y_param);
41 
42  std::pair<double, double> operator()(const double t) const;
43  double x(const double t) const;
44  double y(const double t) const;
45  double DerivativeX(const double t) const;
46  double DerivativeY(const double t) const;
47  double SecondDerivativeX(const double t) const;
48  double SecondDerivativeY(const double t) const;
49  double ThirdDerivativeX(const double t) const;
50  double ThirdDerivativeY(const double t) const;
51 
52  const PolynomialXd& spline_func_x() const;
53  const PolynomialXd& spline_func_y() const;
54  const PolynomialXd& DerivativeX() const;
55  const PolynomialXd& DerivativeY() const;
56  const PolynomialXd& SecondDerivativeX() const;
57  const PolynomialXd& SecondDerivativeY() const;
58  const PolynomialXd& ThirdDerivativeX() const;
59  const PolynomialXd& ThirdDerivativeY() const;
60 
61  private:
62  PolynomialXd spline_func_x_;
63  PolynomialXd spline_func_y_;
64  PolynomialXd derivative_x_;
65  PolynomialXd derivative_y_;
66  PolynomialXd second_derivative_x_;
67  PolynomialXd second_derivative_y_;
68  PolynomialXd third_derivative_x_;
69  PolynomialXd third_derivative_y_;
70 };
71 
72 } // namespace planning
73 } // namespace apollo
double y(const double t) const
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Planning module main class. It processes GPS and IMU as input, to generate planning info...
const PolynomialXd & DerivativeX() const
const PolynomialXd & SecondDerivativeY() const
const PolynomialXd & ThirdDerivativeX() const
const PolynomialXd & spline_func_x() const
bool SetParams(const std::vector< double > &x_param, const std::vector< double > &y_param)
const PolynomialXd & spline_func_y() const
std::pair< double, double > operator()(const double t) const
double x(const double t) const
const PolynomialXd & ThirdDerivativeY() const
Definition: spline_2d_seg.h:31
Spline2dSeg(const uint32_t order)
const PolynomialXd & DerivativeY() const
Definition: polynomial_xd.h:29
const PolynomialXd & SecondDerivativeX() const