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

#include <spline_1d_kernel.h>

apollo::planning::Spline1dKernel 的协作图:

Public 成员函数

 Spline1dKernel (const Spline1d &spline1d)
 
 Spline1dKernel (const std::vector< double > &x_knots, const uint32_t spline_order)
 
void AddRegularization (const double regularized_param)
 
bool AddKernel (const Eigen::MatrixXd &kernel, const Eigen::MatrixXd &offset, const double weight)
 
bool AddKernel (const Eigen::MatrixXd &kernel, const double weight)
 
Eigen::MatrixXd * mutable_kernel_matrix ()
 
Eigen::MatrixXd * mutable_offset ()
 
const Eigen::MatrixXd & kernel_matrix () const
 
const Eigen::MatrixXd & offset () const
 
void AddDerivativeKernelMatrix (const double weight)
 
void AddSecondOrderDerivativeMatrix (const double weight)
 
void AddThirdOrderDerivativeMatrix (const double weight)
 
void AddDerivativeKernelMatrixForSplineK (const uint32_t k, const double weight)
 
void AddSecondOrderDerivativeMatrixForSplineK (const uint32_t k, const double weight)
 
void AddThirdOrderDerivativeMatrixForSplineK (const uint32_t k, const double weight)
 
bool AddReferenceLineKernelMatrix (const std::vector< double > &x_coord, const std::vector< double > &ref_fx, const double weight)
 
void AddDistanceOffset (const double weight)
 

详细描述

在文件 spline_1d_kernel.h 第 34 行定义.

构造及析构函数说明

◆ Spline1dKernel() [1/2]

apollo::planning::Spline1dKernel::Spline1dKernel ( const Spline1d &  spline1d)
explicit

在文件 spline_1d_kernel.cc 第 33 行定义.

34 : Spline1dKernel(spline1d.x_knots(), spline1d.spline_order()) {}
Spline1dKernel(const Spline1d &spline1d)

◆ Spline1dKernel() [2/2]

apollo::planning::Spline1dKernel::Spline1dKernel ( const std::vector< double > &  x_knots,
const uint32_t  spline_order 
)

在文件 spline_1d_kernel.cc 第 36 行定义.

38 : x_knots_(x_knots), spline_order_(spline_order) {
39 total_params_ =
40 (static_cast<uint32_t>(x_knots.size()) > 1
41 ? (static_cast<uint32_t>(x_knots.size()) - 1) * (1 + spline_order_)
42 : 0);
43 kernel_matrix_ = Eigen::MatrixXd::Zero(total_params_, total_params_);
44 offset_ = Eigen::MatrixXd::Zero(total_params_, 1);
45}

成员函数说明

◆ AddDerivativeKernelMatrix()

void apollo::planning::Spline1dKernel::AddDerivativeKernelMatrix ( const double  weight)

在文件 spline_1d_kernel.cc 第 99 行定义.

99 {
100 AddNthDerivativekernelMatrix(1, weight);
101}

◆ AddDerivativeKernelMatrixForSplineK()

void apollo::planning::Spline1dKernel::AddDerivativeKernelMatrixForSplineK ( const uint32_t  k,
const double  weight 
)

在文件 spline_1d_kernel.cc 第 129 行定义.

130 {
131 AddNthDerivativekernelMatrixForSplineK(1, k, weight);
132}

◆ AddDistanceOffset()

void apollo::planning::Spline1dKernel::AddDistanceOffset ( const double  weight)

在文件 spline_1d_kernel.cc 第 190 行定义.

190 {
191 for (uint32_t i = 1; i < x_knots_.size(); ++i) {
192 const double cur_x = x_knots_[i] - x_knots_[i - 1];
193 double pw_x = 2.0 * weight;
194 for (uint32_t j = 0; j < spline_order_ + 1; ++j) {
195 offset_((i - 1) * (spline_order_ + 1) + j, 0) -= pw_x;
196 pw_x *= cur_x;
197 }
198 }
199}

◆ AddKernel() [1/2]

bool apollo::planning::Spline1dKernel::AddKernel ( const Eigen::MatrixXd &  kernel,
const double  weight 
)

在文件 spline_1d_kernel.cc 第 66 行定义.

67 {
68 Eigen::MatrixXd offset = Eigen::MatrixXd::Zero(kernel.rows(), 1);
69 return AddKernel(kernel, offset, weight);
70}
const Eigen::MatrixXd & offset() const
bool AddKernel(const Eigen::MatrixXd &kernel, const Eigen::MatrixXd &offset, const double weight)

◆ AddKernel() [2/2]

bool apollo::planning::Spline1dKernel::AddKernel ( const Eigen::MatrixXd &  kernel,
const Eigen::MatrixXd &  offset,
const double  weight 
)

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

55 {
56 if (kernel.rows() != kernel.cols() ||
57 kernel.rows() != kernel_matrix_.rows() || offset.cols() != 1 ||
58 offset.rows() != offset_.rows()) {
59 return false;
60 }
61 kernel_matrix_ += kernel * weight;
62 offset_ += offset * weight;
63 return true;
64}

◆ AddReferenceLineKernelMatrix()

bool apollo::planning::Spline1dKernel::AddReferenceLineKernelMatrix ( const std::vector< double > &  x_coord,
const std::vector< double > &  ref_fx,
const double  weight 
)

在文件 spline_1d_kernel.cc 第 144 行定义.

146 {
147 if (ref_x.size() != x_coord.size()) {
148 return false;
149 }
150
151 const uint32_t num_params = spline_order_ + 1;
152 for (size_t i = 0; i < x_coord.size(); ++i) {
153 auto cur_index = FindIndex(x_coord[i]);
154 double cur_rel_x = x_coord[i] - x_knots_[cur_index];
155 // update offset
156 double offset_coef = -2.0 * ref_x[i] * weight;
157 for (size_t j = 0; j < num_params; ++j) {
158 offset_(j + cur_index * num_params, 0) += offset_coef;
159 offset_coef *= cur_rel_x;
160 }
161 // update kernel matrix
162 Eigen::MatrixXd ref_kernel(num_params, num_params);
163
164 double cur_x = 1.0;
165 std::vector<double> power_x;
166 for (uint32_t n = 0; n + 1 < 2 * num_params; ++n) {
167 power_x.emplace_back(cur_x);
168 cur_x *= cur_rel_x;
169 }
170
171 for (uint32_t r = 0; r < num_params; ++r) {
172 for (uint32_t c = 0; c < num_params; ++c) {
173 ref_kernel(r, c) = 2.0 * power_x[r + c];
174 }
175 }
176
177 kernel_matrix_.block(cur_index * num_params, cur_index * num_params,
178 num_params, num_params) += weight * ref_kernel;
179 }
180 return true;
181}

◆ AddRegularization()

void apollo::planning::Spline1dKernel::AddRegularization ( const double  regularized_param)

在文件 spline_1d_kernel.cc 第 47 行定义.

47 {
48 Eigen::MatrixXd id_matrix =
49 Eigen::MatrixXd::Identity(kernel_matrix_.rows(), kernel_matrix_.cols());
50 kernel_matrix_ += 2.0 * id_matrix * regularized_param;
51}

◆ AddSecondOrderDerivativeMatrix()

void apollo::planning::Spline1dKernel::AddSecondOrderDerivativeMatrix ( const double  weight)

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

103 {
104 AddNthDerivativekernelMatrix(2, weight);
105}

◆ AddSecondOrderDerivativeMatrixForSplineK()

void apollo::planning::Spline1dKernel::AddSecondOrderDerivativeMatrixForSplineK ( const uint32_t  k,
const double  weight 
)

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

135 {
136 AddNthDerivativekernelMatrixForSplineK(2, k, weight);
137}

◆ AddThirdOrderDerivativeMatrix()

void apollo::planning::Spline1dKernel::AddThirdOrderDerivativeMatrix ( const double  weight)

在文件 spline_1d_kernel.cc 第 107 行定义.

107 {
108 AddNthDerivativekernelMatrix(3, weight);
109}

◆ AddThirdOrderDerivativeMatrixForSplineK()

void apollo::planning::Spline1dKernel::AddThirdOrderDerivativeMatrixForSplineK ( const uint32_t  k,
const double  weight 
)

在文件 spline_1d_kernel.cc 第 139 行定义.

140 {
141 AddNthDerivativekernelMatrixForSplineK(3, k, weight);
142}

◆ kernel_matrix()

const Eigen::MatrixXd & apollo::planning::Spline1dKernel::kernel_matrix ( ) const

在文件 spline_1d_kernel.cc 第 78 行定义.

78 {
79 return kernel_matrix_;
80}

◆ mutable_kernel_matrix()

Eigen::MatrixXd * apollo::planning::Spline1dKernel::mutable_kernel_matrix ( )

在文件 spline_1d_kernel.cc 第 72 行定义.

72 {
73 return &kernel_matrix_;
74}

◆ mutable_offset()

Eigen::MatrixXd * apollo::planning::Spline1dKernel::mutable_offset ( )

在文件 spline_1d_kernel.cc 第 76 行定义.

76{ return &offset_; }

◆ offset()

const Eigen::MatrixXd & apollo::planning::Spline1dKernel::offset ( ) const

在文件 spline_1d_kernel.cc 第 82 行定义.

82{ return offset_; }

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