Apollo 11.0
自动驾驶开放平台
dp_road_graph.h
浏览该文件的文档.
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 "modules/common_msgs/basic_msgs/pnc_point.pb.h"
24#include "modules/planning/planning_base/proto/dp_poly_path_config.pb.h"
25
37
38namespace apollo {
39namespace planning {
40
42 public:
43 DpRoadGraph(const DpPolyPathConfig &config,
44 const ReferenceLineInfo &reference_line_info,
45 const SpeedData &speed_data);
46
47 ~DpRoadGraph() = default;
48
49 bool FindPathTunnel(const common::TrajectoryPoint &init_point,
50 const std::vector<const Obstacle *> &obstacles,
51 PathData *const path_data);
52
53 private:
57 struct DpRoadGraphNode {
58 public:
59 DpRoadGraphNode() = default;
60
61 DpRoadGraphNode(const common::SLPoint point_sl,
62 const DpRoadGraphNode *node_prev)
63 : sl_point(point_sl), min_cost_prev_node(node_prev) {}
64
65 DpRoadGraphNode(const common::SLPoint point_sl,
66 const DpRoadGraphNode *node_prev,
67 const ComparableCost &cost)
68 : sl_point(point_sl), min_cost_prev_node(node_prev), min_cost(cost) {}
69
70 void UpdateCost(const DpRoadGraphNode *node_prev,
71 const QuinticPolynomialCurve1d &curve,
72 const ComparableCost &cost) {
73 if (cost <= min_cost) {
74 min_cost = cost;
75 min_cost_prev_node = node_prev;
76 min_cost_curve = curve;
77 }
78 }
79
80 common::SLPoint sl_point;
81 const DpRoadGraphNode *min_cost_prev_node = nullptr;
82 ComparableCost min_cost = {true, true, true,
83 std::numeric_limits<double>::infinity(),
84 std::numeric_limits<double>::infinity()};
85 QuinticPolynomialCurve1d min_cost_curve;
86 };
87 bool GenerateMinCostPath(const std::vector<const Obstacle *> &obstacles,
88 std::vector<DpRoadGraphNode> *min_cost_path);
89
90 bool IsValidCurve(const QuinticPolynomialCurve1d &curve) const;
91
92 void GetCurveCost(TrajectoryCost trajectory_cost,
93 const QuinticPolynomialCurve1d &curve, const double start_s,
94 const double end_s, const uint32_t curr_level,
95 const uint32_t total_level, ComparableCost *cost);
96
97 struct RoadGraphMessage {
98 RoadGraphMessage(const std::list<DpRoadGraphNode> &_prev_nodes,
99 const uint32_t _level, const uint32_t _total_level,
100 TrajectoryCost *_trajectory_cost, DpRoadGraphNode *_front,
101 DpRoadGraphNode *_cur_node)
102 : prev_nodes(_prev_nodes),
103 level(_level),
104 total_level(_total_level),
105 trajectory_cost(_trajectory_cost),
106 front(_front),
107 cur_node(_cur_node) {}
108 const std::list<DpRoadGraphNode> &prev_nodes;
109 const uint32_t level;
110 const uint32_t total_level;
111 TrajectoryCost *trajectory_cost = nullptr;
112 DpRoadGraphNode *front = nullptr;
113 DpRoadGraphNode *cur_node = nullptr;
114 };
115 void UpdateNode(const std::shared_ptr<RoadGraphMessage> &msg);
116
117 private:
118 DpPolyPathConfig config_;
119 common::TrajectoryPoint init_point_;
120 const ReferenceLineInfo &reference_line_info_;
121 const ReferenceLine &reference_line_;
122 SpeedData speed_data_;
123 common::SLPoint init_sl_point_;
124 common::FrenetFramePoint init_frenet_frame_point_;
125 apollo::planning_internal::Debug *planning_debug_ = nullptr;
126
127 std::unique_ptr<WaypointSampler> waypoint_sampler_;
128};
129
130} // namespace planning
131} // namespace apollo
bool FindPathTunnel(const common::TrajectoryPoint &init_point, const std::vector< const Obstacle * > &obstacles, PathData *const path_data)
ReferenceLineInfo holds all data for one reference line.
Planning module main class.
class register implement
Definition arena_queue.h:37