Apollo 11.0
自动驾驶开放平台
apollo::planning::Spline2d类 参考

#include <spline_2d.h>

apollo::planning::Spline2d 的协作图:

Public 成员函数

 Spline2d (const std::vector< double > &t_knots, const uint32_t order)
 
std::pair< double, double > operator() (const double t) const
 
double x (const double t) const
 
double y (const double t) const
 
double DerivativeX (const double t) const
 
double DerivativeY (const double t) const
 
double SecondDerivativeX (const double t) const
 
double SecondDerivativeY (const double t) const
 
double ThirdDerivativeX (const double t) const
 
double ThirdDerivativeY (const double t) const
 
bool set_splines (const Eigen::MatrixXd &params, const uint32_t order)
 : set splines
 
const Spline2dSeg & smoothing_spline (const uint32_t index) const
 
const std::vector< double > & t_knots () const
 
uint32_t spline_order () const
 

详细描述

在文件 spline_2d.h 第 35 行定义.

构造及析构函数说明

◆ Spline2d()

apollo::planning::Spline2d::Spline2d ( const std::vector< double > &  t_knots,
const uint32_t  order 
)

在文件 spline_2d.cc 第 28 行定义.

29 : t_knots_(t_knots), spline_order_(order) {
30 if (t_knots.size() > 1) {
31 for (uint32_t i = 1; i < t_knots_.size(); ++i) {
32 splines_.emplace_back(spline_order_);
33 }
34 }
35}
const std::vector< double > & t_knots() const
Definition spline_2d.cc:138

成员函数说明

◆ DerivativeX()

double apollo::planning::Spline2d::DerivativeX ( const double  t) const

在文件 spline_2d.cc 第 61 行定义.

61 {
62 // zero order spline
63 if (splines_.empty()) {
64 return 0.0;
65 }
66 uint32_t index = find_index(t);
67 return splines_[index].DerivativeX(t - t_knots_[index]);
68}

◆ DerivativeY()

double apollo::planning::Spline2d::DerivativeY ( const double  t) const

在文件 spline_2d.cc 第 70 行定义.

70 {
71 // zero order spline
72 if (splines_.empty()) {
73 return 0.0;
74 }
75 uint32_t index = find_index(t);
76 return splines_[index].DerivativeY(t - t_knots_[index]);
77}

◆ operator()()

std::pair< double, double > apollo::planning::Spline2d::operator() ( const double  t) const

在文件 spline_2d.cc 第 37 行定义.

37 {
38 if (splines_.empty()) {
39 return std::make_pair(0.0, 0.0);
40 }
41 uint32_t index = find_index(t);
42 return splines_[index](t - t_knots_[index]);
43}

◆ SecondDerivativeX()

double apollo::planning::Spline2d::SecondDerivativeX ( const double  t) const

在文件 spline_2d.cc 第 79 行定义.

79 {
80 if (splines_.empty()) {
81 return 0.0;
82 }
83 uint32_t index = find_index(t);
84 return splines_[index].SecondDerivativeX(t - t_knots_[index]);
85}

◆ SecondDerivativeY()

double apollo::planning::Spline2d::SecondDerivativeY ( const double  t) const

在文件 spline_2d.cc 第 87 行定义.

87 {
88 if (splines_.empty()) {
89 return 0.0;
90 }
91 uint32_t index = find_index(t);
92 return splines_[index].SecondDerivativeY(t - t_knots_[index]);
93}

◆ set_splines()

bool apollo::planning::Spline2d::set_splines ( const Eigen::MatrixXd &  params,
const uint32_t  order 
)

: set splines

在文件 spline_2d.cc 第 113 行定义.

114 {
115 const uint32_t num_params = order + 1;
116 // check if the parameter size fit
117 if (2 * t_knots_.size() * num_params !=
118 2 * num_params + static_cast<uint32_t>(params.rows())) {
119 return false;
120 }
121 for (uint32_t i = 0; i < splines_.size(); ++i) {
122 std::vector<double> spline_piece_x(num_params, 0.0);
123 std::vector<double> spline_piece_y(num_params, 0.0);
124 for (uint32_t j = 0; j < num_params; ++j) {
125 spline_piece_x[j] = params(2 * i * num_params + j, 0);
126 spline_piece_y[j] = params((2 * i + 1) * num_params + j, 0);
127 }
128 splines_[i].SetParams(spline_piece_x, spline_piece_y);
129 }
130 spline_order_ = order;
131 return true;
132}

◆ smoothing_spline()

const Spline2dSeg & apollo::planning::Spline2d::smoothing_spline ( const uint32_t  index) const

在文件 spline_2d.cc 第 134 行定义.

134 {
135 return splines_[index];
136}

◆ spline_order()

uint32_t apollo::planning::Spline2d::spline_order ( ) const

在文件 spline_2d.cc 第 140 行定义.

140{ return spline_order_; }

◆ t_knots()

const std::vector< double > & apollo::planning::Spline2d::t_knots ( ) const

在文件 spline_2d.cc 第 138 行定义.

138{ return t_knots_; }

◆ ThirdDerivativeX()

double apollo::planning::Spline2d::ThirdDerivativeX ( const double  t) const

在文件 spline_2d.cc 第 95 行定义.

95 {
96 if (splines_.empty()) {
97 return 0.0;
98 }
99 uint32_t index = find_index(t);
100 return splines_[index].ThirdDerivativeX(t - t_knots_[index]);
101}

◆ ThirdDerivativeY()

double apollo::planning::Spline2d::ThirdDerivativeY ( const double  t) const

在文件 spline_2d.cc 第 103 行定义.

103 {
104 if (splines_.empty()) {
105 return 0.0;
106 }
107 uint32_t index = find_index(t);
108 return splines_[index].ThirdDerivativeY(t - t_knots_[index]);
109}

◆ x()

double apollo::planning::Spline2d::x ( const double  t) const

在文件 spline_2d.cc 第 45 行定义.

45 {
46 if (splines_.empty()) {
47 return 0.0;
48 }
49 uint32_t index = find_index(t);
50 return splines_[index].x(t - t_knots_[index]);
51}

◆ y()

double apollo::planning::Spline2d::y ( const double  t) const

在文件 spline_2d.cc 第 53 行定义.

53 {
54 if (splines_.empty()) {
55 return 0.0;
56 }
57 uint32_t index = find_index(t);
58 return splines_[index].y(t - t_knots_[index]);
59}

该类的文档由以下文件生成: