Apollo 10.0
自动驾驶开放平台
apollo::prediction::RoadGraph类 参考

#include <road_graph.h>

apollo::prediction::RoadGraph 的协作图:

Public 成员函数

 RoadGraph (const double start_s, const double length, const bool consider_divide, std::shared_ptr< const hdmap::LaneInfo > lane_info_ptr)
 Constructor
 
common::Status BuildLaneGraph (LaneGraph *const lane_graph)
 Build the lane graph.
 
common::Status BuildLaneGraphBidirection (LaneGraph *const lane_graph_ptr)
 
bool IsOnLaneGraph (std::shared_ptr< const hdmap::LaneInfo > lane_info_ptr, const LaneGraph &lane_graph)
 Check if a lane with an s is on the lane graph
 

详细描述

在文件 road_graph.h31 行定义.

构造及析构函数说明

◆ RoadGraph()

apollo::prediction::RoadGraph::RoadGraph ( const double  start_s,
const double  length,
const bool  consider_divide,
std::shared_ptr< const hdmap::LaneInfo lane_info_ptr 
)

Constructor

参数
start_sThe starting longitudinal s value.
lengthThe length to build the road graph.
Ifconsider all successor lanes after dividing.
lane_info_ptrThe starting lane.

在文件 road_graph.cc86 行定义.

89 : start_s_(start_s),
90 length_(length),
91 consider_divide_(consider_divide),
92 lane_info_ptr_(lane_info_ptr) {}

成员函数说明

◆ BuildLaneGraph()

Status apollo::prediction::RoadGraph::BuildLaneGraph ( LaneGraph *const  lane_graph)

Build the lane graph.

参数
Thebuilt lane graph.
返回
The status of the road graph building.

在文件 road_graph.cc94 行定义.

94 {
95 // Sanity checks.
96 if (length_ < 0.0 || lane_info_ptr_ == nullptr) {
97 const auto error_msg = absl::StrCat(
98 "Invalid road graph settings. Road graph length = ", length_);
99 AERROR << error_msg;
100 return Status(ErrorCode::PREDICTION_ERROR, error_msg);
101 }
102 if (lane_graph_ptr == nullptr) {
103 const auto error_msg = "Invalid input lane graph.";
104 AERROR << error_msg;
105 return Status(ErrorCode::PREDICTION_ERROR, error_msg);
106 }
107
108 // Run the recursive function to perform DFS.
109 std::list<LaneSegment> lane_segments;
110 double accumulated_s = 0.0;
111 ConstructLaneSequence(accumulated_s, start_s_, lane_info_ptr_,
112 FLAGS_road_graph_max_search_horizon, consider_divide_,
113 &lane_segments, lane_graph_ptr);
114
115 return Status::OK();
116}
#define AERROR
Definition log.h:44

◆ BuildLaneGraphBidirection()

Status apollo::prediction::RoadGraph::BuildLaneGraphBidirection ( LaneGraph *const  lane_graph_ptr)

在文件 road_graph.cc118 行定义.

118 {
119 // Sanity checks.
120 if (length_ < 0.0 || lane_info_ptr_ == nullptr) {
121 const auto error_msg = absl::StrCat(
122 "Invalid road graph settings. Road graph length = ", length_);
123 AERROR << error_msg;
124 return Status(ErrorCode::PREDICTION_ERROR, error_msg);
125 }
126 if (lane_graph_ptr == nullptr) {
127 const auto error_msg = "Invalid input lane graph.";
128 AERROR << error_msg;
129 return Status(ErrorCode::PREDICTION_ERROR, error_msg);
130 }
131
132 // Run the recursive function to perform DFS.
133 std::list<LaneSegment> lane_segments;
134 LaneGraph lane_graph_successor;
135 ConstructLaneSequence(true, 0.0, start_s_, lane_info_ptr_,
136 FLAGS_road_graph_max_search_horizon, consider_divide_,
137 &lane_segments, &lane_graph_successor);
138 lane_segments.clear();
139 LaneGraph lane_graph_predecessor;
140 length_ = length_ / 2.0;
141 ConstructLaneSequence(false, 0.0, start_s_, lane_info_ptr_,
142 FLAGS_road_graph_max_search_horizon, consider_divide_,
143 &lane_segments, &lane_graph_predecessor);
144 *lane_graph_ptr =
145 CombineLaneGraphs(lane_graph_predecessor, lane_graph_successor);
146
147 return Status::OK();
148}

◆ IsOnLaneGraph()

bool apollo::prediction::RoadGraph::IsOnLaneGraph ( std::shared_ptr< const hdmap::LaneInfo lane_info_ptr,
const LaneGraph lane_graph 
)

Check if a lane with an s is on the lane graph

参数
LaneID
Lanes
Thepointer to the given lane graph
返回
If the given lane ID and lane s is on the lane graph

在文件 road_graph.cc182 行定义.

183 {
184 if (!lane_graph.IsInitialized()) {
185 return false;
186 }
187
188 for (const auto& lane_sequence : lane_graph.lane_sequence()) {
189 for (const auto& lane_segment : lane_sequence.lane_segment()) {
190 if (lane_segment.has_lane_id() &&
191 lane_segment.lane_id() == lane_info_ptr->id().id()) {
192 return true;
193 }
194 }
195 }
196 return false;
197}

该类的文档由以下文件生成: