Apollo  6.0
Open source self driving car software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
path_reference_decider.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2020 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 <memory>
24 #include <string>
25 #include <vector>
26 
28 #include "modules/planning/proto/planning_config.pb.h"
30 
31 namespace apollo {
32 namespace planning {
33 class PathReferenceDecider : public Task {
34  public:
35  PathReferenceDecider(const TaskConfig &config,
36  const std::shared_ptr<DependencyInjector> &injector);
37 
39  Frame *frame, ReferenceLineInfo *reference_line_info) override;
40 
41  private:
42  apollo::common::Status Process(Frame *frame,
43  ReferenceLineInfo *reference_line_info);
44 
53  bool IsValidPathReference(
54  const ReferenceLineInfo &reference_line_info,
55  const PathBoundary &path_bound,
56  const std::vector<common::PathPoint> &path_reference);
57 
62  void PathBoundToLineSegments(
63  const PathBoundary &path_bound,
64  std::vector<std::vector<common::math::LineSegment2d>>
65  *path_bound_segments);
66 
74  void EvaluatePathReference(
75  const PathBoundary &path_bound,
76  const std::vector<common::PathPoint> &path_reference,
77  std::vector<common::PathPoint> *evaluated_path_reference);
78 
89  int IsPointWithinPathBounds(const ReferenceLineInfo &reference_line_info,
90  const PathBoundary &path_bound, const double x,
91  const double y);
92 
99  size_t GetRegularPathBound(
100  const std::vector<PathBoundary> &path_bounds) const;
101 
111  bool IsADCBoxAlongPathReferenceWithinPathBounds(
112  const std::vector<common::TrajectoryPoint> &path_reference,
113  const PathBoundary &regular_path_bound);
114 
115  void ConvertTrajectoryToPath(
116  const std::vector<common::TrajectoryPoint> &trajectory,
117  std::vector<common::PathPoint> *path);
118 
119  void RecordDebugInfo(const std::vector<common::PathPoint> &path_points,
120  const std::string &path_name,
121  ReferenceLineInfo *const reference_line_info);
122 
123  private:
124  static int valid_path_reference_counter_; // count valid path reference
125  static int total_path_counter_; // count total path
126 };
127 
128 } // namespace planning
129 } // namespace apollo
Definition: path_boundary.h:29
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Planning module main class. It processes GPS and IMU as input, to generate planning info...
Frame holds all data for one planning cycle.
Definition: frame.h:61
Definition: path_reference_decider.h:33
ReferenceLineInfo holds all data for one reference line.
Definition: reference_line_info.h:54
apollo::common::Status Execute(Frame *frame, ReferenceLineInfo *reference_line_info) override
Definition: task.h:35
PathReferenceDecider(const TaskConfig &config, const std::shared_ptr< DependencyInjector > &injector)
A general class to denote the return status of an API call. It can either be an OK status for success...
Definition: status.h:43