Apollo  6.0
Open source self driving car software
path_time_graph.h
Go to the documentation of this file.
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 <string>
24 #include <unordered_map>
25 #include <utility>
26 #include <vector>
27 
29 #include "modules/common/proto/geometry.pb.h"
36 
37 namespace apollo {
38 namespace planning {
39 
41  public:
42  PathTimeGraph(const std::vector<const Obstacle*>& obstacles,
43  const std::vector<common::PathPoint>& discretized_ref_points,
44  const ReferenceLineInfo* ptr_reference_line_info,
45  const double s_start, const double s_end, const double t_start,
46  const double t_end, const std::array<double, 3>& init_d);
47 
48  const std::vector<STBoundary>& GetPathTimeObstacles() const;
49 
50  bool GetPathTimeObstacle(const std::string& obstacle_id,
51  STBoundary* path_time_obstacle);
52 
53  std::vector<std::pair<double, double>> GetPathBlockingIntervals(
54  const double t) const;
55 
56  std::vector<std::vector<std::pair<double, double>>> GetPathBlockingIntervals(
57  const double t_start, const double t_end, const double t_resolution);
58 
59  std::pair<double, double> get_path_range() const;
60 
61  std::pair<double, double> get_time_range() const;
62 
63  std::vector<STPoint> GetObstacleSurroundingPoints(
64  const std::string& obstacle_id, const double s_dist,
65  const double t_density) const;
66 
67  bool IsObstacleInGraph(const std::string& obstacle_id);
68 
69  std::vector<std::pair<double, double>> GetLateralBounds(
70  const double s_start, const double s_end, const double s_resolution);
71 
72  private:
73  void SetupObstacles(
74  const std::vector<const Obstacle*>& obstacles,
75  const std::vector<common::PathPoint>& discretized_ref_points);
76 
77  SLBoundary ComputeObstacleBoundary(
78  const std::vector<common::math::Vec2d>& vertices,
79  const std::vector<common::PathPoint>& discretized_ref_points) const;
80 
81  STPoint SetPathTimePoint(const std::string& obstacle_id, const double s,
82  const double t) const;
83 
84  void SetStaticObstacle(
85  const Obstacle* obstacle,
86  const std::vector<common::PathPoint>& discretized_ref_points);
87 
88  void SetDynamicObstacle(
89  const Obstacle* obstacle,
90  const std::vector<common::PathPoint>& discretized_ref_points);
91 
92  void UpdateLateralBoundsByObstacle(
93  const SLBoundary& sl_boundary,
94  const std::vector<double>& discretized_path, const double s_start,
95  const double s_end, std::vector<std::pair<double, double>>* const bounds);
96 
97  private:
98  std::pair<double, double> time_range_;
99  std::pair<double, double> path_range_;
100  const ReferenceLineInfo* ptr_reference_line_info_;
101  std::array<double, 3> init_d_;
102 
103  std::unordered_map<std::string, STBoundary> path_time_obstacle_map_;
104  std::vector<STBoundary> path_time_obstacles_;
105  std::vector<SLBoundary> static_obs_sl_boundaries_;
106 };
107 
108 } // namespace planning
109 } // namespace apollo
Definition: path_time_graph.h:40
const std::vector< STBoundary > & GetPathTimeObstacles() const
std::vector< std::pair< double, double > > GetPathBlockingIntervals(const double t) const
This is the class that associates an Obstacle with its path properties. An obstacle&#39;s path properties...
Definition: obstacle.h:60
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::vector< std::pair< double, double > > GetLateralBounds(const double s_start, const double s_end, const double s_resolution)
Planning module main class. It processes GPS and IMU as input, to generate planning info...
ReferenceLineInfo holds all data for one reference line.
Definition: reference_line_info.h:54
Definition: st_boundary.h:38
Definition: st_point.h:30
std::pair< double, double > get_path_range() const
bool GetPathTimeObstacle(const std::string &obstacle_id, STBoundary *path_time_obstacle)
bool IsObstacleInGraph(const std::string &obstacle_id)
std::pair< double, double > get_time_range() const
PathTimeGraph(const std::vector< const Obstacle *> &obstacles, const std::vector< common::PathPoint > &discretized_ref_points, const ReferenceLineInfo *ptr_reference_line_info, const double s_start, const double s_end, const double t_start, const double t_end, const std::array< double, 3 > &init_d)
Define the Polygon2d class.
std::vector< STPoint > GetObstacleSurroundingPoints(const std::string &obstacle_id, const double s_dist, const double t_density) const