Apollo 11.0
自动驾驶开放平台
spline_1d_seg.cc
浏览该文件的文档.
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
23
24namespace apollo {
25namespace planning {
26
27Spline1dSeg::Spline1dSeg(const uint32_t order) {
28 SetSplineFunc(PolynomialXd(order));
29}
30
31Spline1dSeg::Spline1dSeg(const std::vector<double>& params) {
32 SetSplineFunc(PolynomialXd(params));
33}
34
35void Spline1dSeg::SetParams(const std::vector<double>& params) {
36 SetSplineFunc(PolynomialXd(params));
37}
38
39void Spline1dSeg::SetSplineFunc(const PolynomialXd& spline_func) {
40 spline_func_ = spline_func;
41 derivative_ = PolynomialXd::DerivedFrom(spline_func_);
42 second_order_derivative_ = PolynomialXd::DerivedFrom(derivative_);
43 third_order_derivative_ = PolynomialXd::DerivedFrom(second_order_derivative_);
44}
45
46double Spline1dSeg::operator()(const double x) const { return spline_func_(x); }
47
48double Spline1dSeg::Derivative(const double x) const { return derivative_(x); }
49
50double Spline1dSeg::SecondOrderDerivative(const double x) const {
51 return second_order_derivative_(x);
52}
53
54double Spline1dSeg::ThirdOrderDerivative(const double x) const {
55 return third_order_derivative_(x);
56}
57
58const PolynomialXd& Spline1dSeg::spline_func() const { return spline_func_; }
59
60const PolynomialXd& Spline1dSeg::Derivative() const { return derivative_; }
61
63 return second_order_derivative_;
64}
65
67 return third_order_derivative_;
68}
69
70} // namespace planning
71} // namespace apollo
static PolynomialXd DerivedFrom(const PolynomialXd &base)
const PolynomialXd & Derivative() const
Spline1dSeg(const uint32_t order)
double operator()(const double x) const
const PolynomialXd & SecondOrderDerivative() const
void SetParams(const std::vector< double > &params)
const PolynomialXd & spline_func() const
const PolynomialXd & ThirdOrderDerivative() const
Planning module main class.
class register implement
Definition arena_queue.h:37
: polynomial smoothing spline