Apollo 11.0
自动驾驶开放平台
apollo::planning::QuinticSpiralPathWithDerivation< N > 模板类 参考

#include <quintic_spiral_path_with_derivation.h>

类 apollo::planning::QuinticSpiralPathWithDerivation< N > 继承关系图:
apollo::planning::QuinticSpiralPathWithDerivation< N > 的协作图:

Public 成员函数

 QuinticSpiralPathWithDerivation ()=default
 
 QuinticSpiralPathWithDerivation (const std::array< double, 3 > &start, const std::array< double, 3 > &end, const double delta_s)
 
 QuinticSpiralPathWithDerivation (const double theta0, const double kappa0, const double dkappa0, const double theta1, const double kappa1, const double dkappa1, const double delta_s)
 
virtual ~QuinticSpiralPathWithDerivation ()=default
 
double evaluate (const size_t order, const size_t i, const size_t n)
 
double ComputeCartesianDeviationX () const
 
double ComputeCartesianDeviationY () const
 
std::pair< double, double > DeriveCartesianDeviation (const size_t param_index)
 
double DeriveKappaDerivative (const size_t param_index, const int i, const int n)
 
double DeriveDKappaDerivative (const size_t param_index, const int i, const int n)
 
double ComputeCartesianDeviationX (const double s) const
 
double ComputeCartesianDeviationY (const double s) const
 
- Public 成员函数 继承自 apollo::planning::QuinticPolynomialCurve1d
 QuinticPolynomialCurve1d ()=default
 
 QuinticPolynomialCurve1d (const std::array< double, 3 > &start, const std::array< double, 3 > &end, const double param)
 
 QuinticPolynomialCurve1d (const double x0, const double dx0, const double ddx0, const double x1, const double dx1, const double ddx1, const double param)
 
 QuinticPolynomialCurve1d (const QuinticPolynomialCurve1d &other)
 
void SetParam (const double x0, const double dx0, const double ddx0, const double x1, const double dx1, const double ddx1, const double param)
 
void IntegratedFromQuarticCurve (const PolynomialCurve1d &other, const double init_value)
 
virtual ~QuinticPolynomialCurve1d ()=default
 
double Evaluate (const std::uint32_t order, const double p) const override
 
double ParamLength () const override
 
std::string ToString () const override
 
double Coef (const size_t order) const override
 
size_t Order () const override
 
- Public 成员函数 继承自 apollo::planning::PolynomialCurve1d
 PolynomialCurve1d ()=default
 
virtual ~PolynomialCurve1d ()=default
 
- Public 成员函数 继承自 apollo::planning::Curve1d
 Curve1d ()=default
 
virtual ~Curve1d ()=default
 

静态 Public 属性

static const size_t THETA0 = 0
 
static const size_t KAPPA0 = 1
 
static const size_t DKAPPA0 = 2
 
static const size_t THETA1 = 3
 
static const size_t KAPPA1 = 4
 
static const size_t DKAPPA1 = 5
 
static const size_t DELTA_S = 6
 
static const size_t INDEX_MAX = 7
 

额外继承的成员函数

- Protected 成员函数 继承自 apollo::planning::QuinticPolynomialCurve1d
void ComputeCoefficients (const double x0, const double dx0, const double ddx0, const double x1, const double dx1, const double ddx1, const double param)
 
- Protected 属性 继承自 apollo::planning::QuinticPolynomialCurve1d
std::array< double, 6 > coef_ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}
 
std::array< double, 3 > start_condition_ {{0.0, 0.0, 0.0}}
 
std::array< double, 3 > end_condition_ {{0.0, 0.0, 0.0}}
 
- Protected 属性 继承自 apollo::planning::PolynomialCurve1d
double param_ = 0.0
 

详细描述

template<size_t N>
class apollo::planning::QuinticSpiralPathWithDerivation< N >

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

构造及析构函数说明

◆ QuinticSpiralPathWithDerivation() [1/3]

template<size_t N>
apollo::planning::QuinticSpiralPathWithDerivation< N >::QuinticSpiralPathWithDerivation ( )
default

◆ QuinticSpiralPathWithDerivation() [2/3]

template<size_t N>
apollo::planning::QuinticSpiralPathWithDerivation< N >::QuinticSpiralPathWithDerivation ( const std::array< double, 3 > &  start,
const std::array< double, 3 > &  end,
const double  delta_s 
)

在文件 quintic_spiral_path_with_derivation.h 第 191 行定义.

194 : QuinticSpiralPathWithDerivation<N>(start[0], start[1], start[2], end[0],
195 end[1], end[2], delta_s) {}

◆ QuinticSpiralPathWithDerivation() [3/3]

template<size_t N>
apollo::planning::QuinticSpiralPathWithDerivation< N >::QuinticSpiralPathWithDerivation ( const double  theta0,
const double  kappa0,
const double  dkappa0,
const double  theta1,
const double  kappa1,
const double  dkappa1,
const double  delta_s 
)

在文件 quintic_spiral_path_with_derivation.h 第 116 行定义.

119 : QuinticPolynomialCurve1d(x0, dx0, ddx0, x1, dx1, ddx1, s) {
120 ACHECK(s > 0.0);
121
122 auto gauss_points = common::math::GetGaussLegendrePoints<N>();
123 gauss_points_ = gauss_points.first;
124 gauss_point_weights_ = gauss_points.second;
125
127
129
130 double s2 = s * s;
131 double s3 = s2 * s;
132 double s4 = s3 * s;
133 double s5 = s2 * s3;
134 double s6 = s3 * s3;
135
136 for (size_t i = 0; i < 6; ++i) {
137 for (size_t j = 0; j < 7; ++j) {
138 coef_deriv_[i][j] = 0.0;
139 }
140 }
141 // derive a
142 // double a = -6.0 * x0 / p5 - 3.0 * dx0 / p4 - 0.5 * ddx0 / p3 + 6.0 * x1 /
143 // p5 - 3.0 * dx1 / p4 + 0.5 * ddx1 / p3;
144 coef_deriv_[5][0] = -6.0 / s5;
145 coef_deriv_[5][1] = -3.0 / s4;
146 coef_deriv_[5][2] = -0.5 / s3;
147 coef_deriv_[5][3] = 6.0 / s5;
148 coef_deriv_[5][4] = -3.0 / s4;
149 coef_deriv_[5][5] = 0.5 / s3;
150 coef_deriv_[5][6] = 30.0 * x0 / s6 + 12.0 * dx0 / s5 + 1.5 * ddx0 / s4 -
151 30.0 * x1 / s6 + 12.0 * dx1 / s5 - 1.5 * ddx1 / s4;
152
153 // derive b
154 // double b = 15.0 * x0 / p4 + 8.0 * dx0 / p3 + 1.5 * ddx0 / p2 - 15.0 * x1 /
155 // p4 + 7.0 * dx1 / p3 - ddx1 / p2;
156 coef_deriv_[4][0] = 15.0 / s4;
157 coef_deriv_[4][1] = 8.0 / s3;
158 coef_deriv_[4][2] = 1.5 / s2;
159 coef_deriv_[4][3] = -15.0 / s4;
160 coef_deriv_[4][4] = 7.0 / s3;
161 coef_deriv_[4][5] = -1.0 / s2;
162 coef_deriv_[4][6] = -60.0 * x0 / s5 - 24.0 * dx0 / s4 - 3.0 * ddx0 / s3 +
163 60.0 * x1 / s5 - 21.0 * dx1 / s4 + 2.0 * ddx1 / s3;
164
165 // derive c
166 // double c = -10.0 * x0 / p3 - 6.0 * dx0 / p2 - 1.5 * ddx0 / p + 10.0 * x1 /
167 // p3 - 4.0 * dx1 / p2 + 0.5 * ddx1 / p;
168 coef_deriv_[3][0] = -10.0 / s3;
169 coef_deriv_[3][1] = -6.0 / s2;
170 coef_deriv_[3][2] = -1.5 / s;
171 coef_deriv_[3][3] = 10.0 / s3;
172 coef_deriv_[3][4] = -4.0 / s2;
173 coef_deriv_[3][5] = 0.5 / s;
174 coef_deriv_[3][6] = 30.0 * x0 / s4 + 12.0 * dx0 / s3 + 1.5 * ddx0 / s2 -
175 30.0 * x1 / s4 + 8.0 * dx1 / s3 - 0.5 * ddx1 / s2;
176
177 // derive d
178 // double d = 0.5 * ddx0;
179 coef_deriv_[2][2] = 0.5;
180
181 // derive e
182 // double e = dx0;
183 coef_deriv_[1][1] = 1.0;
184
185 // derive f
186 // double f = x0;
187 coef_deriv_[0][0] = 1.0;
188}
#define ACHECK(cond)
Definition log.h:80

◆ ~QuinticSpiralPathWithDerivation()

template<size_t N>
virtual apollo::planning::QuinticSpiralPathWithDerivation< N >::~QuinticSpiralPathWithDerivation ( )
virtualdefault

成员函数说明

◆ ComputeCartesianDeviationX() [1/2]

template<size_t N>
double apollo::planning::QuinticSpiralPathWithDerivation< N >::ComputeCartesianDeviationX ( ) const
inline

在文件 quintic_spiral_path_with_derivation.h 第 51 行定义.

51{ return dx_; }

◆ ComputeCartesianDeviationX() [2/2]

template<size_t N>
double apollo::planning::QuinticSpiralPathWithDerivation< N >::ComputeCartesianDeviationX ( const double  s) const
inline

在文件 quintic_spiral_path_with_derivation.h 第 73 行定义.

73 {
74 auto cos_theta = [this](const double s) {
75 const auto a = Evaluate(0, s);
76 return std::cos(a);
77 };
78 return common::math::IntegrateByGaussLegendre<N>(cos_theta, 0.0, s);
79 }
double Evaluate(const std::uint32_t order, const double p) const override

◆ ComputeCartesianDeviationY() [1/2]

template<size_t N>
double apollo::planning::QuinticSpiralPathWithDerivation< N >::ComputeCartesianDeviationY ( ) const
inline

在文件 quintic_spiral_path_with_derivation.h 第 53 行定义.

53{ return dy_; }

◆ ComputeCartesianDeviationY() [2/2]

template<size_t N>
double apollo::planning::QuinticSpiralPathWithDerivation< N >::ComputeCartesianDeviationY ( const double  s) const
inline

在文件 quintic_spiral_path_with_derivation.h 第 81 行定义.

81 {
82 auto sin_theta = [this](const double s) {
83 const auto a = Evaluate(0, s);
84 return std::sin(a);
85 };
86 return common::math::IntegrateByGaussLegendre<N>(sin_theta, 0.0, s);
87 }

◆ DeriveCartesianDeviation()

template<size_t N>
std::pair< double, double > apollo::planning::QuinticSpiralPathWithDerivation< N >::DeriveCartesianDeviation ( const size_t  param_index)

在文件 quintic_spiral_path_with_derivation.h 第 213 行定义.

214 {
215 if (cache_cartesian_deriv_.find(param_index) !=
216 cache_cartesian_deriv_.end()) {
217 return cache_cartesian_deriv_[param_index];
218 }
219
220 const auto& g = gauss_points_;
221 const auto& w = gauss_point_weights_;
222
223 std::pair<double, double> cartesian_deviation = {0.0, 0.0};
224 if (param_index != DELTA_S) {
225 for (size_t i = 0; i < N; ++i) {
226 double r = 0.5 * g[i] + 0.5;
227 cartesian_deviation.first += w[i] * DeriveCosTheta(param_index, r);
228 cartesian_deviation.second += w[i] * DeriveSinTheta(param_index, r);
229 }
230
231 cartesian_deviation.first *= param_ * 0.5;
232 cartesian_deviation.second *= param_ * 0.5;
233 } else {
234 for (size_t i = 0; i < N; ++i) {
235 double r = 0.5 * g[i] + 0.5;
236 cartesian_deviation.first += w[i] * DeriveCosTheta(param_index, r);
237 cartesian_deviation.second += w[i] * DeriveSinTheta(param_index, r);
238 }
239
240 cartesian_deviation.first *= param_ * 0.5;
241 cartesian_deviation.second *= param_ * 0.5;
242
243 for (size_t i = 0; i < N; ++i) {
244 double r = 0.5 * g[i] + 0.5;
245 auto theta = Evaluate(0, r * param_);
246
247 cartesian_deviation.first += 0.5 * w[i] * std::cos(theta);
248 cartesian_deviation.second += 0.5 * w[i] * std::sin(theta);
249 }
250 }
251 cache_cartesian_deriv_[param_index] = cartesian_deviation;
252 return cartesian_deviation;
253}

◆ DeriveDKappaDerivative()

template<size_t N>
double apollo::planning::QuinticSpiralPathWithDerivation< N >::DeriveDKappaDerivative ( const size_t  param_index,
const int  i,
const int  n 
)

在文件 quintic_spiral_path_with_derivation.h 第 285 行定义.

286 {
287 auto key = param_index * INDEX_MAX + i;
288 if (cache_dkappa_deriv_.find(key) != cache_dkappa_deriv_.end()) {
289 return cache_dkappa_deriv_[key];
290 }
291
292 auto r = static_cast<double>(i) / static_cast<double>(n);
293 double s = param_ * r;
294 double s2 = s * s;
295 double s3 = s2 * s;
296
297 double derivative = 20.0 * coef_deriv_[5][param_index] * s3 +
298 12.0 * coef_deriv_[4][param_index] * s2 +
299 6.0 * coef_deriv_[3][param_index] * s +
300 2.0 * coef_deriv_[2][param_index];
301
302 if (param_index == DELTA_S) {
303 derivative +=
304 60.0 * coef_[5] * s2 * r + 24.0 * coef_[4] * s * r + 6.0 * coef_[3] * r;
305 }
306
307 cache_dkappa_deriv_[key] = derivative;
308 return derivative;
309}

◆ DeriveKappaDerivative()

template<size_t N>
double apollo::planning::QuinticSpiralPathWithDerivation< N >::DeriveKappaDerivative ( const size_t  param_index,
const int  i,
const int  n 
)

在文件 quintic_spiral_path_with_derivation.h 第 256 行定义.

257 {
258 auto key = param_index * INDEX_MAX + i;
259 if (cache_kappa_deriv_.find(key) != cache_kappa_deriv_.end()) {
260 return cache_kappa_deriv_[key];
261 }
262
263 auto r = static_cast<double>(i) / static_cast<double>(n);
264 double s = param_ * r;
265 double s2 = s * s;
266 double s3 = s2 * s;
267 double s4 = s2 * s2;
268
269 double derivative = 5.0 * coef_deriv_[5][param_index] * s4 +
270 4.0 * coef_deriv_[4][param_index] * s3 +
271 3.0 * coef_deriv_[3][param_index] * s2 +
272 2.0 * coef_deriv_[2][param_index] * s +
273 coef_deriv_[1][param_index];
274
275 if (param_index == DELTA_S) {
276 derivative += 20.0 * coef_[5] * s3 * r + 12.0 * coef_[4] * s2 * r +
277 6.0 * coef_[3] * s * r + 2.0 * coef_[2] * r;
278 }
279
280 cache_kappa_deriv_[key] = derivative;
281 return derivative;
282}

◆ evaluate()

template<size_t N>
double apollo::planning::QuinticSpiralPathWithDerivation< N >::evaluate ( const size_t  order,
const size_t  i,
const size_t  n 
)

在文件 quintic_spiral_path_with_derivation.h 第 198 行定义.

200 {
201 auto key = order * 100 + n * 10 + i;
202 if (cache_evaluate_.find(key) != cache_evaluate_.end()) {
203 return cache_evaluate_[key];
204 }
205 auto res =
206 Evaluate(order, static_cast<double>(i) / static_cast<double>(n) * param_);
207 cache_evaluate_[key] = res;
208 return res;
209}

类成员变量说明

◆ DELTA_S

template<size_t N>
const size_t apollo::planning::QuinticSpiralPathWithDerivation< N >::DELTA_S = 6
static

在文件 quintic_spiral_path_with_derivation.h 第 69 行定义.

◆ DKAPPA0

template<size_t N>
const size_t apollo::planning::QuinticSpiralPathWithDerivation< N >::DKAPPA0 = 2
static

在文件 quintic_spiral_path_with_derivation.h 第 65 行定义.

◆ DKAPPA1

template<size_t N>
const size_t apollo::planning::QuinticSpiralPathWithDerivation< N >::DKAPPA1 = 5
static

在文件 quintic_spiral_path_with_derivation.h 第 68 行定义.

◆ INDEX_MAX

template<size_t N>
const size_t apollo::planning::QuinticSpiralPathWithDerivation< N >::INDEX_MAX = 7
static

在文件 quintic_spiral_path_with_derivation.h 第 71 行定义.

◆ KAPPA0

template<size_t N>
const size_t apollo::planning::QuinticSpiralPathWithDerivation< N >::KAPPA0 = 1
static

在文件 quintic_spiral_path_with_derivation.h 第 64 行定义.

◆ KAPPA1

template<size_t N>
const size_t apollo::planning::QuinticSpiralPathWithDerivation< N >::KAPPA1 = 4
static

在文件 quintic_spiral_path_with_derivation.h 第 67 行定义.

◆ THETA0

template<size_t N>
const size_t apollo::planning::QuinticSpiralPathWithDerivation< N >::THETA0 = 0
static

在文件 quintic_spiral_path_with_derivation.h 第 63 行定义.

◆ THETA1

template<size_t N>
const size_t apollo::planning::QuinticSpiralPathWithDerivation< N >::THETA1 = 3
static

在文件 quintic_spiral_path_with_derivation.h 第 66 行定义.


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