Apollo 11.0
自动驾驶开放平台
path_bounds_decider_util.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2023 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#pragma once
17
18#include <string>
19#include <tuple>
20#include <unordered_map>
21#include <utility>
22#include <vector>
23
28
29namespace apollo {
30namespace planning {
31// ObstacleEdge contains: (is_start_s, s, l_min, l_max, obstacle_id).
32using ObstacleEdge = std::tuple<int, double, double, double, std::string>;
33// SLSstate contains: (s ,s' ,s''), (l, l', l'')
34using SLState = std::pair<std::array<double, 3>, std::array<double, 3>>;
35
36enum class LaneBorrowInfo {
40};
41
43 public:
48 static bool InitPathBoundary(const ReferenceLineInfo& reference_line_info,
49 PathBoundary* const path_bound,
50 SLState init_sl_state);
55 static void GetStartPoint(common::TrajectoryPoint planning_start_point,
56 const ReferenceLine& reference_line,
57 SLState* init_sl_state);
61 static double GetADCLaneWidth(const ReferenceLine& reference_line,
62 const double adc_frenet_s);
69 const ReferenceLineInfo& reference_line_info,
70 const LaneBorrowInfo& lane_borrow_info, bool is_extend_adc,
71 double ADC_buffer, PathBoundary* const path_bound,
72 std::string* const borrow_lane_type, bool is_fallback_lanechange,
73 const SLState& init_sl_state);
83 double left_bound, double right_bound, BoundType left_type,
84 BoundType right_type, std::string left_id, std::string right_id,
85 PathBoundPoint* const bound_point);
89 double right_bound, BoundType right_type, std::string right_id,
90 PathBoundPoint* const bound_point);
92 double left_bound, BoundType left_type, std::string left_id,
93 PathBoundPoint* const bound_point);
94 static void TrimPathBounds(const int path_blocked_idx,
95 PathBoundary* const path_boundaries);
102 const std::unordered_map<std::string, double>& obs_id_to_start_s);
108 const ReferenceLineInfo& reference_line_info,
109 std::vector<SLPolygon>* const sl_polygons, const SLState& init_sl_state,
110 PathBoundary* const path_boundaries,
111 std::string* const blocking_obstacle_id, double* const narrowest_width);
112
113 static std::vector<ObstacleEdge> SortObstaclesForSweepLine(
114 const IndexedList<std::string, Obstacle>& indexed_obstacles,
115 const SLState& init_sl_state);
127 size_t idx, double left_bound, double right_bound,
128 PathBoundary* const path_boundaries, double* const center_line);
132 static double GetBufferBetweenADCCenterAndEdge();
137 static bool IsWithinPathDeciderScopeObstacle(const Obstacle& obstacle);
145 static bool ComputeSLBoundaryIntersection(const SLBoundary& sl_boundary,
146 const double s, double* ptr_l_min,
147 double* ptr_l_max);
149 const common::TrajectoryPoint& traj_point);
157 static bool GetBoundaryFromSelfLane(
158 const ReferenceLineInfo& reference_line_info,
159 const SLState& init_sl_state, PathBoundary* const path_bound);
160
161 static bool GetBoundaryFromRoad(const ReferenceLineInfo& reference_line_info,
162 const SLState& init_sl_state,
163 PathBoundary* const path_bound);
164
172 static bool ExtendBoundaryByADC(const ReferenceLineInfo& reference_line_info,
173 const SLState& init_sl_state,
174 const double extend_buffer,
175 PathBoundary* const path_bound);
177 const ReferenceLineInfo& reference_line_info,
178 PathBoundary* const path_bound);
179 static int IsPointWithinPathBound(
180 const ReferenceLineInfo& reference_line_info, const double x,
181 const double y, const PathBound& path_bound);
182 static void GetSLPolygons(const ReferenceLineInfo& reference_line_info,
183 std::vector<SLPolygon>* polygons,
184 const SLState& init_sl_state);
186 const ReferenceLineInfo& reference_line_info,
187 std::vector<SLPolygon>* const sl_polygon, const SLState& init_sl_state,
188 PathBoundary* const path_boundary, std::string* const blocked_id,
189 double* const narrowest_width);
190 static bool AddCornerPoint(double s, double l_lower, double l_upper,
191 const PathBoundary& path_boundary,
192 ObsCornerConstraints* extra_constraints);
193 static bool AddCornerPoint(SLPoint sl_pt, const PathBoundary& path_boundary,
194 ObsCornerConstraints* extra_constraints,
195 bool is_left, std::string obs_id,
196 bool is_front_pt);
197 static void AddCornerBounds(const std::vector<SLPolygon>& sl_polygons,
198 PathBoundary* const path_boundary);
199 static void AddAdcVertexBounds(PathBoundary* const path_boundary);
200 static bool RelaxBoundaryPoint(PathBoundPoint* const path_bound_point,
201 bool is_left, double init_l, double heading,
202 double delta_s, double init_frenet_kappa,
203 double min_radius);
204 static bool RelaxEgoPathBoundary(PathBoundary* const path_boundary,
205 const SLState& init_sl_state);
206 static bool RelaxObsCornerBoundary(PathBoundary* const path_boundary,
207 const SLState& init_sl_state);
208
209 static bool AddExtraPathBound(const std::vector<SLPolygon>& sl_polygons,
210 PathBoundary* const path_boundary,
211 const SLState& init_sl_state,
212 std::string* const blocked_id);
214 PathBoundary* const path_boundary, std::string* const blocked_id);
215};
216
217} // namespace planning
218} // namespace apollo
This is the class that associates an Obstacle with its path properties.
Definition obstacle.h:62
static bool GetBoundaryFromSelfLane(const ReferenceLineInfo &reference_line_info, const SLState &init_sl_state, PathBoundary *const path_bound)
generate path bound by self lane and adc position
static bool ComputeSLBoundaryIntersection(const SLBoundary &sl_boundary, const double s, double *ptr_l_min, double *ptr_l_max)
Check is sl range has intersection with sl_boundary
static bool RelaxObsCornerBoundary(PathBoundary *const path_boundary, const SLState &init_sl_state)
static bool UpdatePathBoundaryBySLPolygon(const ReferenceLineInfo &reference_line_info, std::vector< SLPolygon > *const sl_polygon, const SLState &init_sl_state, PathBoundary *const path_boundary, std::string *const blocked_id, double *const narrowest_width)
static bool ExtendBoundaryByADC(const ReferenceLineInfo &reference_line_info, const SLState &init_sl_state, const double extend_buffer, PathBoundary *const path_bound)
extend boundary to include adc
static bool UpdatePathBoundaryAndCenterLineWithBuffer(size_t idx, double left_bound, double right_bound, PathBoundary *const path_boundaries, double *const center_line)
Update the path_boundary at "idx", as well as the new center-line.
static bool UpdateLeftPathBoundaryWithBuffer(double left_bound, BoundType left_type, std::string left_id, PathBoundPoint *const bound_point)
static bool RelaxEgoPathBoundary(PathBoundary *const path_boundary, const SLState &init_sl_state)
static void AddCornerBounds(const std::vector< SLPolygon > &sl_polygons, PathBoundary *const path_boundary)
static bool AddExtraPathBound(const std::vector< SLPolygon > &sl_polygons, PathBoundary *const path_boundary, const SLState &init_sl_state, std::string *const blocked_id)
static std::vector< ObstacleEdge > SortObstaclesForSweepLine(const IndexedList< std::string, Obstacle > &indexed_obstacles, const SLState &init_sl_state)
static bool AddCornerPoint(double s, double l_lower, double l_upper, const PathBoundary &path_boundary, ObsCornerConstraints *extra_constraints)
static void ConvertBoundarySAxisFromLaneCenterToRefLine(const ReferenceLineInfo &reference_line_info, PathBoundary *const path_bound)
static std::string FindFarthestBlockObstaclesId(const std::unordered_map< std::string, double > &obs_id_to_start_s)
Find the farthest obstacle's id which ADC is blocked by
static bool GetBoundaryFromStaticObstacles(const ReferenceLineInfo &reference_line_info, std::vector< SLPolygon > *const sl_polygons, const SLState &init_sl_state, PathBoundary *const path_boundaries, std::string *const blocking_obstacle_id, double *const narrowest_width)
Refine the boundary based on static obstacles.
static int IsPointWithinPathBound(const ReferenceLineInfo &reference_line_info, const double x, const double y, const PathBound &path_bound)
static bool GetBoundaryFromRoad(const ReferenceLineInfo &reference_line_info, const SLState &init_sl_state, PathBoundary *const path_bound)
static bool GetBoundaryFromLanesAndADC(const ReferenceLineInfo &reference_line_info, const LaneBorrowInfo &lane_borrow_info, bool is_extend_adc, double ADC_buffer, PathBoundary *const path_bound, std::string *const borrow_lane_type, bool is_fallback_lanechange, const SLState &init_sl_state)
Refine the boundary based on lane-info and ADC's location.
static void AddAdcVertexBounds(PathBoundary *const path_boundary)
static bool UpdateBlockInfoWithObsCornerBoundary(PathBoundary *const path_boundary, std::string *const blocked_id)
static common::TrajectoryPoint InferFrontAxeCenterFromRearAxeCenter(const common::TrajectoryPoint &traj_point)
static void GetStartPoint(common::TrajectoryPoint planning_start_point, const ReferenceLine &reference_line, SLState *init_sl_state)
Starting from ADC's current position, increment until the horizon, and and set lateral bounds to be i...
static void TrimPathBounds(const int path_blocked_idx, PathBoundary *const path_boundaries)
static bool RelaxBoundaryPoint(PathBoundPoint *const path_bound_point, bool is_left, double init_l, double heading, double delta_s, double init_frenet_kappa, double min_radius)
static bool UpdatePathBoundaryWithBuffer(double left_bound, double right_bound, BoundType left_type, BoundType right_type, std::string left_id, std::string right_id, PathBoundPoint *const bound_point)
Update the path_boundary at "idx" It also checks if ADC is blocked (lmax < lmin).
static double GetBufferBetweenADCCenterAndEdge()
Get the distance between ADC's center and its edge.
static void GetSLPolygons(const ReferenceLineInfo &reference_line_info, std::vector< SLPolygon > *polygons, const SLState &init_sl_state)
static double GetADCLaneWidth(const ReferenceLine &reference_line, const double adc_frenet_s)
Get lane width in init_sl_state.
static bool IsWithinPathDeciderScopeObstacle(const Obstacle &obstacle)
Is obstacle should be considered in path decision
static bool InitPathBoundary(const ReferenceLineInfo &reference_line_info, PathBoundary *const path_bound, SLState init_sl_state)
Starting from ADC's current position, increment until the path length, and set lateral bounds to be i...
static bool UpdateRightPathBoundaryWithBuffer(double right_bound, BoundType right_type, std::string right_id, PathBoundPoint *const bound_point)
Trim the path bounds starting at the idx where path is blocked.
ReferenceLineInfo holds all data for one reference line.
Planning module main class.
std::pair< std::array< double, 3 >, std::array< double, 3 > > SLState
std::vector< PathBoundPoint > PathBound
std::tuple< int, double, double, double, std::string > ObstacleEdge
class register implement
Definition arena_queue.h:37