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

#include <spline_2d_kernel.h>

apollo::planning::Spline2dKernel 的协作图:

Public 成员函数

 Spline2dKernel (const std::vector< double > &t_knots, const uint32_t spline_order)
 
void AddRegularization (const double regularization_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 ()
 
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)
 
bool AddReferenceLineKernelMatrix (const std::vector< double > &t_coord, const std::vector< common::math::Vec2d > &ref_points, const double weight)
 

详细描述

在文件 spline_2d_kernel.h 第 33 行定义.

构造及析构函数说明

◆ Spline2dKernel()

apollo::planning::Spline2dKernel::Spline2dKernel ( const std::vector< double > &  t_knots,
const uint32_t  spline_order 
)

在文件 spline_2d_kernel.cc 第 32 行定义.

34 : t_knots_(t_knots), spline_order_(spline_order) {
35 total_params_ =
36 (t_knots_.size() > 1 ? 2 * (t_knots_.size() - 1) * (1 + spline_order_)
37 : 0);
38 kernel_matrix_ = Eigen::MatrixXd::Zero(total_params_, total_params_);
39 offset_ = Eigen::MatrixXd::Zero(total_params_, 1);
40}

成员函数说明

◆ AddDerivativeKernelMatrix()

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

在文件 spline_2d_kernel.cc 第 97 行定义.

97 {
98 AddNthDerivativeKernelMatrix(1, weight);
99}

◆ AddKernel() [1/2]

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

在文件 spline_2d_kernel.cc 第 62 行定义.

63 {
64 Eigen::MatrixXd offset = Eigen::MatrixXd::Zero(kernel.rows(), 1);
65 return AddKernel(kernel, offset, weight);
66}
bool AddKernel(const Eigen::MatrixXd &kernel, const Eigen::MatrixXd &offset, const double weight)
const Eigen::MatrixXd offset() const

◆ AddKernel() [2/2]

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

在文件 spline_2d_kernel.cc 第 49 行定义.

51 {
52 if (kernel.rows() != kernel.cols() ||
53 kernel.rows() != kernel_matrix_.rows() || offset.cols() != 1 ||
54 offset.rows() != offset_.rows()) {
55 return false;
56 }
57 kernel_matrix_ += kernel * weight;
58 offset_ += offset * weight;
59 return true;
60}

◆ AddReferenceLineKernelMatrix()

bool apollo::planning::Spline2dKernel::AddReferenceLineKernelMatrix ( const std::vector< double > &  t_coord,
const std::vector< common::math::Vec2d > &  ref_points,
const double  weight 
)

在文件 spline_2d_kernel.cc 第 111 行定义.

113 {
114 if (ref_points.size() != t_coord.size()) {
115 return false;
116 }
117
118 for (uint32_t i = 0; i < t_coord.size(); ++i) {
119 auto cur_index = find_index(t_coord[i]);
120 double cur_rel_t = t_coord[i] - t_knots_[cur_index];
121 // update offset
122 double offset_coef_x = -ref_points[i].x() * weight;
123 double offset_coef_y = -ref_points[i].y() * weight;
124 const uint32_t num_params = spline_order_ + 1;
125 for (uint32_t j = 0; j < num_params; ++j) {
126 offset_(j + (2 * cur_index) * num_params, 0) = offset_coef_x;
127 offset_(j + (2 * cur_index + 1) * num_params, 0) = offset_coef_y;
128 offset_coef_x *= cur_rel_t;
129 offset_coef_y *= cur_rel_t;
130 }
131
132 // update kernel matrix
133 Eigen::MatrixXd ref_kernel(num_params, num_params);
134
135 double cur_t = 1.0;
136 std::vector<double> power_t;
137 for (uint32_t n = 0; n + 1 < 2 * num_params; ++n) {
138 power_t.emplace_back(cur_t);
139 cur_t *= cur_rel_t;
140 }
141
142 for (uint32_t r = 0; r < num_params; ++r) {
143 for (uint32_t c = 0; c < num_params; ++c) {
144 ref_kernel(r, c) = power_t[r + c];
145 }
146 }
147 kernel_matrix_.block((2 * cur_index) * num_params,
148 (2 * cur_index) * num_params, num_params,
149 num_params) += weight * ref_kernel;
150 kernel_matrix_.block((2 * cur_index + 1) * num_params,
151 (2 * cur_index + 1) * num_params, num_params,
152 num_params) += weight * ref_kernel;
153 }
154 return true;
155}

◆ AddRegularization()

void apollo::planning::Spline2dKernel::AddRegularization ( const double  regularization_param)

在文件 spline_2d_kernel.cc 第 43 行定义.

43 {
44 Eigen::MatrixXd id_matrix =
45 Eigen::MatrixXd::Identity(kernel_matrix_.rows(), kernel_matrix_.cols());
46 kernel_matrix_ += id_matrix * regularization_param;
47}

◆ AddSecondOrderDerivativeMatrix()

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

在文件 spline_2d_kernel.cc 第 101 行定义.

101 {
102 AddNthDerivativeKernelMatrix(2, weight);
103}

◆ AddThirdOrderDerivativeMatrix()

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

在文件 spline_2d_kernel.cc 第 105 行定义.

105 {
106 AddNthDerivativeKernelMatrix(3, weight);
107}

◆ kernel_matrix()

Eigen::MatrixXd apollo::planning::Spline2dKernel::kernel_matrix ( ) const

在文件 spline_2d_kernel.cc 第 74 行定义.

74 {
75 return kernel_matrix_ * 2.0;
76}

◆ mutable_kernel_matrix()

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

在文件 spline_2d_kernel.cc 第 68 行定义.

68 {
69 return &kernel_matrix_;
70}

◆ mutable_offset()

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

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

72{ return &offset_; }

◆ offset()

const Eigen::MatrixXd apollo::planning::Spline2dKernel::offset ( ) const

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

78{ return offset_; }

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