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

Describe a quintic spiral path Map (theta0, kappa0, dkappa0) --— delta_s --—> (theta1, kappa1, dkappa1) 更多...

#include <quintic_spiral_path.h>

类 apollo::planning::QuinticSpiralPath 继承关系图:
apollo::planning::QuinticSpiralPath 的协作图:

Public 成员函数

 QuinticSpiralPath ()=default
 
 QuinticSpiralPath (const std::array< double, 3 > &start, const std::array< double, 3 > &end, const double delta_s)
 
 QuinticSpiralPath (const double theta0, const double kappa0, const double dkappa0, const double theta1, const double kappa1, const double dkappa1, const double delta_s)
 
template<size_t N>
double ComputeCartesianDeviationX (const double s) const
 
template<size_t N>
double ComputeCartesianDeviationY (const double s) const
 
template<size_t N>
std::pair< double, double > DeriveCartesianDeviation (const size_t param_index) const
 
double DeriveKappaDerivative (const size_t param_index, const double ratio) const
 
double DeriveDKappaDerivative (const size_t param_index, const double ratio) const
 
double DeriveD2KappaDerivative (const size_t param_index, const double r) 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
 

额外继承的成员函数

- 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
 

详细描述

Describe a quintic spiral path Map (theta0, kappa0, dkappa0) --— delta_s --—> (theta1, kappa1, dkappa1)

在文件 quintic_spiral_path.h 第 37 行定义.

构造及析构函数说明

◆ QuinticSpiralPath() [1/3]

apollo::planning::QuinticSpiralPath::QuinticSpiralPath ( )
default

◆ QuinticSpiralPath() [2/3]

apollo::planning::QuinticSpiralPath::QuinticSpiralPath ( const std::array< double, 3 > &  start,
const std::array< double, 3 > &  end,
const double  delta_s 
)

在文件 quintic_spiral_path.cc 第 142 行定义.

145 : QuinticSpiralPath(start[0], start[1], start[2], end[0], end[1], end[2],
146 delta_s) {}

◆ QuinticSpiralPath() [3/3]

apollo::planning::QuinticSpiralPath::QuinticSpiralPath ( 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.cc 第 26 行定义.

30 : QuinticPolynomialCurve1d(x0, dx0, ddx0, x1, dx1, ddx1, p) {
31 ACHECK(p > 0.0);
32
33 double p2 = p * p;
34 double p3 = p2 * p;
35 double p4 = p3 * p;
36 double p5 = p2 * p3;
37 double p6 = p3 * p3;
38
39 // derive a
40 // double a = -6.0 * x0 / p5 - 3.0 * dx0 / p4 - 0.5 * ddx0 / p3 + 6.0 * x1 /
41 // p5 - 3.0 * dx1 / p4 + 0.5 * ddx1 / p3;
42 coef_deriv_[5][0] = -6.0 / p5;
43
44 coef_deriv_[5][1] = -3.0 / p4;
45
46 coef_deriv_[5][2] = -0.5 / p3;
47
48 coef_deriv_[5][3] = 6.0 / p5;
49
50 coef_deriv_[5][4] = -3.0 / p4;
51
52 coef_deriv_[5][5] = 0.5 / p3;
53
54 coef_deriv_[5][6] = 30.0 * x0 / p6 + 12.0 * dx0 / p5 + 1.5 * ddx0 / p4 -
55 30.0 * x1 / p6 + 12.0 * dx1 / p5 - 1.5 * ddx1 / p4;
56
57 // derive b
58 // double b = 15.0 * x0 / p4 + 8.0 * dx0 / p3 + 1.5 * ddx0 / p2 - 15.0 * x1 /
59 // p4 + 7.0 * dx1 / p3 - ddx1 / p2;
60 coef_deriv_[4][0] = 15.0 / p4;
61
62 coef_deriv_[4][1] = 8.0 / p3;
63
64 coef_deriv_[4][2] = 1.5 / p2;
65
66 coef_deriv_[4][3] = -15.0 / p4;
67
68 coef_deriv_[4][4] = 7.0 / p3;
69
70 coef_deriv_[4][5] = -1.0 / p2;
71
72 coef_deriv_[4][6] = -60.0 * x0 / p5 - 24.0 * dx0 / p4 - 3.0 * ddx0 / p3 +
73 60.0 * x1 / p5 - 21.0 * dx1 / p4 + 2.0 * ddx1 / p3;
74
75 // derive c
76 // double c = -10.0 * x0 / p3 - 6.0 * dx0 / p2 - 1.5 * ddx0 / p + 10.0 * x1 /
77 // p3 - 4.0 * dx1 / p2 + 0.5 * ddx1 / p;
78 coef_deriv_[3][0] = -10.0 / p3;
79
80 coef_deriv_[3][1] = -6.0 / p2;
81
82 coef_deriv_[3][2] = -1.5 / p;
83
84 coef_deriv_[3][3] = 10.0 / p3;
85
86 coef_deriv_[3][4] = -4.0 / p2;
87
88 coef_deriv_[3][5] = 0.5 / p;
89
90 coef_deriv_[3][6] = 30.0 * x0 / p4 + 12.0 * dx0 / p3 + 1.5 * ddx0 / p2 -
91 30.0 * x1 / p4 + 8.0 * dx1 / p3 - 0.5 * ddx1 / p2;
92
93 // derive d
94 // double d = 0.5 * ddx0;
95 coef_deriv_[2][0] = 0.0;
96
97 coef_deriv_[2][1] = 0.0;
98
99 coef_deriv_[2][2] = 0.5;
100
101 coef_deriv_[2][3] = 0.0;
102
103 coef_deriv_[2][4] = 0.0;
104
105 coef_deriv_[2][5] = 0.0;
106
107 coef_deriv_[2][6] = 0.0;
108
109 // derive e
110 // double e = dx0;
111 coef_deriv_[1][0] = 0.0;
112
113 coef_deriv_[1][1] = 1.0;
114
115 coef_deriv_[1][2] = 0.0;
116
117 coef_deriv_[1][3] = 0.0;
118
119 coef_deriv_[1][4] = 0.0;
120
121 coef_deriv_[1][5] = 0.0;
122
123 coef_deriv_[1][6] = 0.0;
124
125 // derive f
126 // double f = x0;
127 coef_deriv_[0][0] = 1.0;
128
129 coef_deriv_[0][1] = 0.0;
130
131 coef_deriv_[0][2] = 0.0;
132
133 coef_deriv_[0][3] = 0.0;
134
135 coef_deriv_[0][4] = 0.0;
136
137 coef_deriv_[0][5] = 0.0;
138
139 coef_deriv_[0][6] = 0.0;
140}
#define ACHECK(cond)
Definition log.h:80

成员函数说明

◆ ComputeCartesianDeviationX()

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

在文件 quintic_spiral_path.h 第 50 行定义.

50 {
51 auto cos_theta = [this](const double s) {
52 const auto a = Evaluate(0, s);
53 return std::cos(a);
54 };
55 return common::math::IntegrateByGaussLegendre<N>(cos_theta, 0.0, s);
56 }
double Evaluate(const std::uint32_t order, const double p) const override

◆ ComputeCartesianDeviationY()

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

在文件 quintic_spiral_path.h 第 59 行定义.

59 {
60 auto sin_theta = [this](const double s) {
61 const auto a = Evaluate(0, s);
62 return std::sin(a);
63 };
64 return common::math::IntegrateByGaussLegendre<N>(sin_theta, 0.0, s);
65 }

◆ DeriveCartesianDeviation()

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

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

69 {
70 auto gauss_points = common::math::GetGaussLegendrePoints<N>();
71 std::array<double, N> x = gauss_points.first;
72 std::array<double, N> w = gauss_points.second;
73
74 std::pair<double, double> cartesian_deviation = {0.0, 0.0};
75 for (size_t i = 0; i < N; ++i) {
76 double r = 0.5 * x[i] + 0.5;
77 auto curr_theta = Evaluate(0, r * param_);
78 double derived_theta = DeriveTheta(param_index, r);
79
80 cartesian_deviation.first +=
81 w[i] * (-std::sin(curr_theta)) * derived_theta;
82 cartesian_deviation.second += w[i] * std::cos(curr_theta) * derived_theta;
83 }
84
85 cartesian_deviation.first *= param_ * 0.5;
86 cartesian_deviation.second *= param_ * 0.5;
87
88 if (param_index == DELTA_S) {
89 for (size_t i = 0; i < N; ++i) {
90 double r = 0.5 * x[i] + 0.5;
91 auto theta_angle = Evaluate(0, r * param_);
92
93 cartesian_deviation.first += 0.5 * w[i] * std::cos(theta_angle);
94 cartesian_deviation.second += 0.5 * w[i] * std::sin(theta_angle);
95 }
96 }
97 return cartesian_deviation;
98 }

◆ DeriveD2KappaDerivative()

double apollo::planning::QuinticSpiralPath::DeriveD2KappaDerivative ( const size_t  param_index,
const double  r 
) const

在文件 quintic_spiral_path.cc 第 208 行定义.

209 {
210 double s = param_ * r;
211 double s2 = s * s;
212
213 double derivative = 60.0 * coef_deriv_[5][param_index] * s2 +
214 24.0 * coef_deriv_[4][param_index] * s +
215 6.0 * coef_deriv_[3][param_index];
216
217 if (param_index == DELTA_S) {
218 derivative += 60.0 * coef_[5] * 2.0 * s * r + 24.0 * coef_[4] * r;
219 }
220 return derivative;
221}

◆ DeriveDKappaDerivative()

double apollo::planning::QuinticSpiralPath::DeriveDKappaDerivative ( const size_t  param_index,
const double  ratio 
) const

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

191 {
192 double s = param_ * r;
193 double s2 = s * s;
194 double s3 = s2 * s;
195
196 double derivative = 20.0 * coef_deriv_[5][param_index] * s3 +
197 12.0 * coef_deriv_[4][param_index] * s2 +
198 6.0 * coef_deriv_[3][param_index] * s +
199 2.0 * coef_deriv_[2][param_index];
200
201 if (param_index == DELTA_S) {
202 derivative += 20.0 * coef_[5] * 3.0 * s2 * r +
203 12.0 * coef_[4] * 2.0 * s * r + 6.0 * coef_[3] * r;
204 }
205 return derivative;
206}

◆ DeriveKappaDerivative()

double apollo::planning::QuinticSpiralPath::DeriveKappaDerivative ( const size_t  param_index,
const double  ratio 
) const

在文件 quintic_spiral_path.cc 第 169 行定义.

170 {
171 double s = param_ * r;
172 double s2 = s * s;
173 double s3 = s2 * s;
174 double s4 = s2 * s2;
175
176 double derivative = 5.0 * coef_deriv_[5][param_index] * s4 +
177 4.0 * coef_deriv_[4][param_index] * s3 +
178 3.0 * coef_deriv_[3][param_index] * s2 +
179 2.0 * coef_deriv_[2][param_index] * s +
180 coef_deriv_[1][param_index];
181
182 if (param_index == DELTA_S) {
183 derivative += 5.0 * coef_[5] * 4.0 * s3 * r +
184 4.0 * coef_[4] * 3.0 * s2 * r + 3.0 * coef_[3] * 2.0 * s * r +
185 2.0 * coef_[2] * r;
186 }
187 return derivative;
188}

类成员变量说明

◆ DELTA_S

const size_t apollo::planning::QuinticSpiralPath::DELTA_S = 6
static

在文件 quintic_spiral_path.h 第 115 行定义.

◆ DKAPPA0

const size_t apollo::planning::QuinticSpiralPath::DKAPPA0 = 2
static

在文件 quintic_spiral_path.h 第 111 行定义.

◆ DKAPPA1

const size_t apollo::planning::QuinticSpiralPath::DKAPPA1 = 5
static

在文件 quintic_spiral_path.h 第 114 行定义.

◆ KAPPA0

const size_t apollo::planning::QuinticSpiralPath::KAPPA0 = 1
static

在文件 quintic_spiral_path.h 第 110 行定义.

◆ KAPPA1

const size_t apollo::planning::QuinticSpiralPath::KAPPA1 = 4
static

在文件 quintic_spiral_path.h 第 113 行定义.

◆ THETA0

const size_t apollo::planning::QuinticSpiralPath::THETA0 = 0
static

在文件 quintic_spiral_path.h 第 109 行定义.

◆ THETA1

const size_t apollo::planning::QuinticSpiralPath::THETA1 = 3
static

在文件 quintic_spiral_path.h 第 112 行定义.


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