Apollo 11.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 {
44public:
45 IterativeAnchoringSmoother(const PlannerOpenSpaceConfig& planner_open_space_config);
46
48
49 bool Smooth(
50 const Eigen::MatrixXd& xWS,
51 const double init_a,
52 const double init_v,
53 const std::vector<std::vector<common::math::Vec2d>>& obstacles_vertices_vec,
54 DiscretizedTrajectory* discretized_trajectory);
55
56private:
57 void AdjustStartEndHeading(const Eigen::MatrixXd& xWS, std::vector<std::pair<double, double>>* const point2d);
58
59 bool ReAnchoring(const std::vector<size_t>& colliding_point_index, DiscretizedPath* path_points);
60
61 bool GenerateInitialBounds(const DiscretizedPath& path_points, std::vector<double>* initial_bounds);
62
63 bool CheckCollisionAvoidance(const DiscretizedPath& path_points, std::vector<size_t>* colliding_point_index);
64
65 void AdjustPathBounds(const std::vector<size_t>& colliding_point_index, std::vector<double>* bounds);
66
67 bool SetPathProfile(const std::vector<std::pair<double, double>>& point2d, DiscretizedPath* raw_path_points);
68
69 bool CheckGear(const Eigen::MatrixXd& xWS);
70
71 bool SmoothSpeed(const double init_a, const double init_v, const double path_length, SpeedData* smoothed_speeds);
72
73 bool CombinePathAndSpeed(
74 const DiscretizedPath& path_points,
75 const SpeedData& speed_points,
76 DiscretizedTrajectory* discretized_trajectory);
77
78 void AdjustPathAndSpeedByGear(DiscretizedTrajectory* discretized_trajectory);
79
80 bool GenerateStopProfileFromPolynomial(
81 const double init_acc,
82 const double init_speed,
83 const double stop_distance,
84 SpeedData* smoothed_speeds);
85
86 bool IsValidPolynomialProfile(const QuinticPolynomialCurve1d& curve);
87
88 // @brief: a helper function on discrete point heading adjustment
89 double CalcHeadings(const DiscretizedPath& path_points, const size_t index);
90
91private:
92 // vehicle_param
93 double ego_length_ = 0.0;
94 double ego_width_ = 0.0;
95 double center_shift_distance_ = 0.0;
96
97 std::vector<std::vector<common::math::LineSegment2d>> obstacles_linesegments_vec_;
98
99 std::vector<size_t> input_colliding_point_index_;
100
101 bool enforce_initial_kappa_ = true;
102
103 // gear DRIVE as true and gear REVERSE as false
104 bool gear_ = false;
105
106 PlannerOpenSpaceConfig planner_open_space_config_;
107
108 // park generic
109public:
110 explicit IterativeAnchoringSmoother(const IterativeAnchoringConfig& iterative_anchoring_config);
111
112 std::vector<std::vector<common::math::Vec2d>> box_vec_;
113 std::vector<std::vector<std::vector<common::math::Vec2d>>> box_vec_vec_;
114
115private:
116 IterativeAnchoringConfig iterative_anchoring_config_;
117
118 bool SmoothPath(
119 const DiscretizedPath& raw_path_points,
120 const std::vector<double>& bounds,
121 DiscretizedPath* smoothed_path_points,
122 std::vector<std::vector<common::math::Vec2d>> point_box = {});
123};
124} // namespace planning
125} // 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_
Planning module main class.
Define the LineSegment2d class.
class register implement
Definition arena_queue.h:37
Defines the Vec2d class.