Apollo 11.0
自动驾驶开放平台
spline_2d_constraint.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
21#pragma once
22
23#include <vector>
24
25#include "Eigen/Core"
26
30
31namespace apollo {
32namespace planning {
33
35 public:
36 Spline2dConstraint(const std::vector<double>& t_knots, const uint32_t order);
37
38 // direct method
39 bool AddInequalityConstraint(const Eigen::MatrixXd& constraint_matrix,
40 const Eigen::MatrixXd& constraint_boundary);
41 bool AddEqualityConstraint(const Eigen::MatrixXd& constraint_matrix,
42 const Eigen::MatrixXd& constraint_boundary);
43
44 // preset method
50 bool Add2dBoundary(const std::vector<double>& t_coord,
51 const std::vector<double>& angle,
52 const std::vector<apollo::common::math::Vec2d>& ref_point,
53 const std::vector<double>& longitudinal_bound,
54 const std::vector<double>& lateral_bound);
55
56 // ref point refer to derivative reference point
58 const std::vector<double>& t_coord, const std::vector<double>& angle,
59 const std::vector<apollo::common::math::Vec2d>& ref_point,
60 const std::vector<double>& longitudinal_bound,
61 const std::vector<double>& lateral_bound);
62
63 // ref point refer to second derivative ref point
65 const std::vector<double>& t_coord, const std::vector<double>& angle,
66 const std::vector<apollo::common::math::Vec2d>& ref_point,
67 const std::vector<double>& longitudinal_bound,
68 const std::vector<double>& lateral_bound);
69
70 // ref point refer to third derivative ref point
72 const std::vector<double>& t_coord, const std::vector<double>& angle,
73 const std::vector<apollo::common::math::Vec2d>& ref_point,
74 const std::vector<double>& longitudinal_bound,
75 const std::vector<double>& lateral_bound);
76
77 bool AddPointConstraint(const double t, const double x, const double y);
78 bool AddPointSecondDerivativeConstraint(const double t, const double ddx,
79 const double ddy);
80 bool AddPointThirdDerivativeConstraint(const double t, const double dddx,
81 const double dddy);
82 bool AddPointAngleConstraint(const double t, const double angle);
83
84 // guarantee up to values are joint
86
87 // guarantee up to derivative are joint
89
90 // guarantee up to second order derivative are joint
92
93 // guarantee up to third order derivative are joint
95
101
102 private:
103 uint32_t FindIndex(const double t) const;
104 std::vector<double> AffineCoef(const double angle, const double t) const;
105 std::vector<double> AffineDerivativeCoef(const double angle,
106 const double t) const;
107 std::vector<double> AffineSecondDerivativeCoef(const double angle,
108 const double t) const;
109 std::vector<double> AffineThirdDerivativeCoef(const double angle,
110 const double t) const;
111 std::vector<double> PolyCoef(const double t) const;
112 std::vector<double> DerivativeCoef(const double t) const;
113 std::vector<double> SecondDerivativeCoef(const double t) const;
114 std::vector<double> ThirdDerivativeCoef(const double t) const;
115 double SignDistance(const apollo::common::math::Vec2d& xy_point,
116 const double angle) const;
117 bool AddPointKthOrderDerivativeConstraint(
118 const double t, const double x_kth_derivative,
119 const double y_kth_derivative, const std::vector<double>& kth_coeff);
120
121 private:
122 AffineConstraint inequality_constraint_;
123 AffineConstraint equality_constraint_;
124 std::vector<double> t_knots_;
125 uint32_t spline_order_;
126 uint32_t total_param_;
127};
128
129} // namespace planning
130} // namespace apollo
Implements a class of 2-dimensional vectors.
Definition vec2d.h:42
bool AddPointThirdDerivativeConstraint(const double t, const double dddx, const double dddy)
bool AddEqualityConstraint(const Eigen::MatrixXd &constraint_matrix, const Eigen::MatrixXd &constraint_boundary)
bool Add2dThirdDerivativeBoundary(const std::vector< double > &t_coord, const std::vector< double > &angle, const std::vector< apollo::common::math::Vec2d > &ref_point, const std::vector< double > &longitudinal_bound, const std::vector< double > &lateral_bound)
const AffineConstraint & equality_constraint() const
bool Add2dBoundary(const std::vector< double > &t_coord, const std::vector< double > &angle, const std::vector< apollo::common::math::Vec2d > &ref_point, const std::vector< double > &longitudinal_bound, const std::vector< double > &lateral_bound)
: inequality boundary constraints if no boundary, do specify either by std::infinity or let vector....
bool AddPointSecondDerivativeConstraint(const double t, const double ddx, const double ddy)
bool AddInequalityConstraint(const Eigen::MatrixXd &constraint_matrix, const Eigen::MatrixXd &constraint_boundary)
bool AddPointAngleConstraint(const double t, const double angle)
bool Add2dDerivativeBoundary(const std::vector< double > &t_coord, const std::vector< double > &angle, const std::vector< apollo::common::math::Vec2d > &ref_point, const std::vector< double > &longitudinal_bound, const std::vector< double > &lateral_bound)
bool Add2dSecondDerivativeBoundary(const std::vector< double > &t_coord, const std::vector< double > &angle, const std::vector< apollo::common::math::Vec2d > &ref_point, const std::vector< double > &longitudinal_bound, const std::vector< double > &lateral_bound)
const AffineConstraint & inequality_constraint() const
: output interface inequality constraint
bool AddPointConstraint(const double t, const double x, const double y)
Planning module main class.
class register implement
Definition arena_queue.h:37
: piecewise smoothing spline 2d class
Defines the Vec2d class.