Apollo 10.0
自动驾驶开放平台
iterative_anchoring_smoother.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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
17/*
18 * @file
19 */
20
21#pragma once
22
23#include <utility>
24#include <vector>
25
26#include "Eigen/Eigen"
27
28#include "modules/common_msgs/planning_msgs/planning.pb.h"
29#include "modules/planning/planning_open_space/proto/planner_open_space_config.pb.h"
30
40
41namespace apollo {
42namespace planning {
44 public:
46 const PlannerOpenSpaceConfig& planner_open_space_config);
47
49
50 bool Smooth(const Eigen::MatrixXd& xWS, const double init_a,
51 const double init_v,
52 const std::vector<std::vector<common::math::Vec2d>>&
53 obstacles_vertices_vec,
54 DiscretizedTrajectory* discretized_trajectory);
55
56 private:
57 void AdjustStartEndHeading(
58 const Eigen::MatrixXd& xWS,
59 std::vector<std::pair<double, double>>* const point2d);
60
61 bool ReAnchoring(const std::vector<size_t>& colliding_point_index,
62 DiscretizedPath* path_points);
63
64 bool GenerateInitialBounds(const DiscretizedPath& path_points,
65 std::vector<double>* initial_bounds);
66
67 bool CheckCollisionAvoidance(const DiscretizedPath& path_points,
68 std::vector<size_t>* colliding_point_index);
69
70 void AdjustPathBounds(const std::vector<size_t>& colliding_point_index,
71 std::vector<double>* bounds);
72
73 bool SetPathProfile(const std::vector<std::pair<double, double>>& point2d,
74 DiscretizedPath* raw_path_points);
75
76 bool CheckGear(const Eigen::MatrixXd& xWS);
77
78 bool SmoothSpeed(const double init_a, const double init_v,
79 const double path_length, SpeedData* smoothed_speeds);
80
81 bool CombinePathAndSpeed(const DiscretizedPath& path_points,
82 const SpeedData& speed_points,
83 DiscretizedTrajectory* discretized_trajectory);
84
85 void AdjustPathAndSpeedByGear(DiscretizedTrajectory* discretized_trajectory);
86
87 bool GenerateStopProfileFromPolynomial(const double init_acc,
88 const double init_speed,
89 const double stop_distance,
90 SpeedData* smoothed_speeds);
91
92 bool IsValidPolynomialProfile(const QuinticPolynomialCurve1d& curve);
93
94 // @brief: a helper function on discrete point heading adjustment
95 double CalcHeadings(const DiscretizedPath& path_points, const size_t index);
96
97 private:
98 // vehicle_param
99 double ego_length_ = 0.0;
100 double ego_width_ = 0.0;
101 double center_shift_distance_ = 0.0;
102
103 std::vector<std::vector<common::math::LineSegment2d>>
104 obstacles_linesegments_vec_;
105
106 std::vector<size_t> input_colliding_point_index_;
107
108 bool enforce_initial_kappa_ = true;
109
110 // gear DRIVE as true and gear REVERSE as false
111 bool gear_ = false;
112
113 PlannerOpenSpaceConfig planner_open_space_config_;
114
115// park generic
116 public:
118 const IterativeAnchoringConfig& iterative_anchoring_config);
119
120 std::vector<std::vector<common::math::Vec2d>> box_vec_;
121 std::vector<std::vector<std::vector<common::math::Vec2d>>> box_vec_vec_;
122
123 private:
124 IterativeAnchoringConfig iterative_anchoring_config_;
125
126 bool SmoothPath(
127 const DiscretizedPath& raw_path_points,
128 const std::vector<double>& bounds,
129 DiscretizedPath* smoothed_path_points,
130 std::vector<std::vector<common::math::Vec2d>> point_box = {});
131};
132} // namespace planning
133} // namespace apollo
The class of Box2d.
bool Smooth(const Eigen::MatrixXd &xWS, const double init_a, const double init_v, const std::vector< std::vector< common::math::Vec2d > > &obstacles_vertices_vec, DiscretizedTrajectory *discretized_trajectory)
std::vector< std::vector< common::math::Vec2d > > box_vec_
std::vector< std::vector< std::vector< common::math::Vec2d > > > box_vec_vec_
IterativeAnchoringSmoother(const IterativeAnchoringConfig &iterative_anchoring_config)
Planning module main class.
Define the LineSegment2d class.
class register implement
Definition arena_queue.h:37
Defines the Vec2d class.