Apollo 10.0
自动驾驶开放平台
apollo::routing 命名空间参考

命名空间

namespace  edge_creator
 
namespace  node_creator
 

class  AStarStrategy
 
class  BlackListRangeGenerator
 
struct  CurvePoint
 
struct  CurveRange
 
struct  Edge
 
struct  Graph
 
class  GraphCreator
 
struct  Landmark
 
struct  LaneSegment
 
struct  LaneWaypoint
 
struct  Measurement
 
class  Navigator
 
struct  Node
 
class  NodeSRange
 
class  NodeWithRange
 
struct  ParkingInfo
 
struct  Passage
 
struct  POI
 
class  ResultGenerator
 
struct  RoadSegment
 
class  Routing
 
class  RoutingComponent
 
struct  RoutingConfig
 
struct  RoutingRequest
 
struct  RoutingResponse
 
class  Strategy
 
class  SubTopoGraph
 
struct  TopicConfig
 
class  TopoEdge
 
class  TopoGraph
 
class  TopoNode
 
class  TopoRangeManager
 

枚举

enum  DeadEndRoutingType { ROUTING_OTHER = 0 , ROUTING_IN = 1 , ROUTING_OUT = 2 }
 
enum  ChangeLaneType { FORWARD = 0 , LEFT = 1 , RIGHT = 2 }
 
enum  ParkingSpaceType { VERTICAL_PLOT = 0 , PARALLEL_PARKING = 1 }
 
enum  TopoEdgeType { TET_FORWARD , TET_LEFT , TET_RIGHT }
 

函数

bool IsCloseEnough (double value_1, double value_2)
 
const NodeWithRangeGetLargestRange (const std::vector< NodeWithRange > &node_vec)
 
void LaneNodesToPassageRegion (const std::vector< NodeWithRange >::const_iterator begin, const std::vector< NodeWithRange >::const_iterator end, Passage *const passage)
 
void LaneNodesToPassageRegion (const std::vector< NodeWithRange > &nodes, Passage *const passage)
 
double CalculateDistance (const std::vector< NodeWithRange > &nodes)
 
void PrintDebugInfo (const std::string &road_id, const std::vector< std::vector< NodeWithRange > > &nodes)
 
template<typename T >
int BinarySearchForSLarger (const std::vector< T > &sorted_vec, double value_s)
 
template<typename T >
int BinarySearchForSSmaller (const std::vector< T > &sorted_vec, double value_s)
 
template<typename T >
int BinarySearchCheckValidSIndex (const std::vector< T > &sorted_vec, int index, double value_s)
 
template<typename T >
int BinarySearchForStartS (const std::vector< T > &sorted_vec, double value_s)
 
template<typename T >
int BinarySearchForEndS (const std::vector< T > &sorted_vec, double value_s)
 
void GetNodeDetailForTest (Node *const node, const std::string &lane_id, const std::string &road_id)
 
void GetNodeForTest (Node *const node, const std::string &lane_id, const std::string &road_id)
 
void GetEdgeForTest (Edge *const edge, const std::string &lane_id_1, const std::string &lane_id_2, const Edge::DirectionType &type)
 
void GetGraphForTest (Graph *graph)
 
void GetGraph2ForTest (Graph *graph)
 
void GetGraph3ForTest (Graph *graph)
 

变量

constexpr double S_GAP_FOR_BLACK = 0.01
 
const char TEST_MAP_VERSION [] = "1.0.1"
 
const char TEST_MAP_DISTRICT [] = "yongfeng"
 
const char TEST_L1 [] = "L1"
 
const char TEST_L2 [] = "L2"
 
const char TEST_L3 [] = "L3"
 
const char TEST_L4 [] = "L4"
 
const char TEST_L5 [] = "L5"
 
const char TEST_L6 [] = "L6"
 
const char TEST_R1 [] = "R1"
 
const char TEST_R2 [] = "R2"
 
const char TEST_R3 [] = "R3"
 
const double TEST_LANE_LENGTH = 100.0
 
const double TEST_LANE_COST = 1.1
 
const double TEST_EDGE_COST = 2.2
 
const double TEST_START_S = 0.0
 
const double TEST_MIDDLE_S = 0.0
 
const double TEST_END_S = TEST_LANE_LENGTH
 

枚举类型说明

◆ ChangeLaneType

枚举值
FORWARD 
LEFT 
RIGHT 

在文件 geometry.proto33 行定义.

33 {
34 FORWARD = 0;
35 LEFT = 1;
36 RIGHT = 2;
37};

◆ DeadEndRoutingType

枚举值
ROUTING_OTHER 
ROUTING_IN 
ROUTING_OUT 

在文件 geometry.proto23 行定义.

◆ ParkingSpaceType

枚举值
VERTICAL_PLOT 
PARALLEL_PARKING 

在文件 poi.proto9 行定义.

9 {
10 VERTICAL_PLOT = 0;
12}

◆ TopoEdgeType

枚举值
TET_FORWARD 
TET_LEFT 
TET_RIGHT 

在文件 topo_node.h115 行定义.

函数说明

◆ BinarySearchCheckValidSIndex()

template<typename T >
int apollo::routing::BinarySearchCheckValidSIndex ( const std::vector< T > &  sorted_vec,
int  index,
double  value_s 
)

在文件 range_utils.h75 行定义.

76 {
77 if (index == -1) {
78 return -1;
79 }
80 double start_s = sorted_vec[index].StartS();
81 double end_s = sorted_vec[index].EndS();
82 static const double distance_error = 0.02;
83 if (start_s <= value_s + distance_error &&
84 end_s >= value_s - distance_error) {
85 return index;
86 }
87 return -1;
88}

◆ BinarySearchForEndS()

template<typename T >
int apollo::routing::BinarySearchForEndS ( const std::vector< T > &  sorted_vec,
double  value_s 
)

在文件 range_utils.h97 行定义.

97 {
98 int index = BinarySearchForSSmaller(sorted_vec, value_s);
99 return BinarySearchCheckValidSIndex(sorted_vec, index, value_s);
100}
int BinarySearchForSSmaller(const std::vector< T > &sorted_vec, double value_s)
Definition range_utils.h:50
int BinarySearchCheckValidSIndex(const std::vector< T > &sorted_vec, int index, double value_s)
Definition range_utils.h:75

◆ BinarySearchForSLarger()

template<typename T >
int apollo::routing::BinarySearchForSLarger ( const std::vector< T > &  sorted_vec,
double  value_s 
)

在文件 range_utils.h25 行定义.

25 {
26 if (sorted_vec.empty()) {
27 return -1;
28 }
29 int start_index = 0;
30 int end_index = static_cast<int>(sorted_vec.size()) - 1;
31 double internal_s = 0.0;
32 int middle_index = 0;
33 while (end_index - start_index > 1) {
34 middle_index = (start_index + end_index) / 2;
35 internal_s = sorted_vec[middle_index].StartS();
36 if (internal_s > value_s) {
37 end_index = middle_index;
38 } else {
39 start_index = middle_index;
40 }
41 }
42 double end_s = sorted_vec[start_index].EndS();
43 if (value_s <= end_s) {
44 return start_index;
45 }
46 return end_index;
47}

◆ BinarySearchForSSmaller()

template<typename T >
int apollo::routing::BinarySearchForSSmaller ( const std::vector< T > &  sorted_vec,
double  value_s 
)

在文件 range_utils.h50 行定义.

50 {
51 if (sorted_vec.empty()) {
52 return -1;
53 }
54 int start_index = 0;
55 int end_index = static_cast<int>(sorted_vec.size()) - 1;
56 double internal_s = 0.0;
57 int middle_index = 0;
58 while (end_index - start_index > 1) {
59 middle_index = (start_index + end_index) / 2;
60 internal_s = sorted_vec[middle_index].EndS();
61 if (internal_s > value_s) {
62 end_index = middle_index;
63 } else {
64 start_index = middle_index;
65 }
66 }
67 double start_s = sorted_vec[end_index].StartS();
68 if (value_s > start_s) {
69 return end_index;
70 }
71 return start_index;
72}

◆ BinarySearchForStartS()

template<typename T >
int apollo::routing::BinarySearchForStartS ( const std::vector< T > &  sorted_vec,
double  value_s 
)

在文件 range_utils.h91 行定义.

91 {
92 int index = BinarySearchForSLarger(sorted_vec, value_s);
93 return BinarySearchCheckValidSIndex(sorted_vec, index, value_s);
94}
int BinarySearchForSLarger(const std::vector< T > &sorted_vec, double value_s)
Definition range_utils.h:25

◆ CalculateDistance()

double apollo::routing::CalculateDistance ( const std::vector< NodeWithRange > &  nodes)

在文件 result_generator.cc278 行定义.

278 {
279 double distance = nodes.at(0).EndS() - nodes.at(0).StartS();
280 for (size_t i = 1; i < nodes.size(); ++i) {
281 auto edge =
282 nodes.at(i - 1).GetTopoNode()->GetOutEdgeTo(nodes.at(i).GetTopoNode());
283 if (edge == nullptr || edge->Type() != TET_FORWARD) {
284 continue;
285 }
286 distance += nodes.at(i).EndS() - nodes.at(i).StartS();
287 }
288 return distance;
289}

◆ GetEdgeForTest()

void apollo::routing::GetEdgeForTest ( Edge *const  edge,
const std::string &  lane_id_1,
const std::string &  lane_id_2,
const Edge::DirectionType type 
)

在文件 topo_test_utils.cc82 行定义.

84 {
85 edge->set_from_lane_id(lane_id_1);
86 edge->set_to_lane_id(lane_id_2);
87 edge->set_cost(TEST_EDGE_COST);
88 edge->set_direction_type(type);
89}

◆ GetGraph2ForTest()

void apollo::routing::GetGraph2ForTest ( Graph graph)

在文件 topo_test_utils.cc107 行定义.

107 {
108 graph->set_hdmap_version(TEST_MAP_VERSION);
109 graph->set_hdmap_district(TEST_MAP_DISTRICT);
110 GetNodeForTest(graph->add_node(), TEST_L1, TEST_R1);
111 GetNodeForTest(graph->add_node(), TEST_L2, TEST_R1);
112 GetNodeForTest(graph->add_node(), TEST_L3, TEST_R2);
113 GetNodeForTest(graph->add_node(), TEST_L4, TEST_R2);
114 GetNodeForTest(graph->add_node(), TEST_L5, TEST_R2);
115 GetNodeForTest(graph->add_node(), TEST_L6, TEST_R3);
116
117 GetEdgeForTest(graph->add_edge(), TEST_L1, TEST_L2, Edge::RIGHT);
118 GetEdgeForTest(graph->add_edge(), TEST_L2, TEST_L1, Edge::LEFT);
119 GetEdgeForTest(graph->add_edge(), TEST_L3, TEST_L4, Edge::RIGHT);
120 GetEdgeForTest(graph->add_edge(), TEST_L4, TEST_L3, Edge::LEFT);
121 GetEdgeForTest(graph->add_edge(), TEST_L4, TEST_L5, Edge::RIGHT);
122 GetEdgeForTest(graph->add_edge(), TEST_L5, TEST_L4, Edge::LEFT);
123 GetEdgeForTest(graph->add_edge(), TEST_L1, TEST_L3, Edge::FORWARD);
124 GetEdgeForTest(graph->add_edge(), TEST_L2, TEST_L4, Edge::FORWARD);
125 GetEdgeForTest(graph->add_edge(), TEST_L5, TEST_L6, Edge::FORWARD);
126}
void GetNodeForTest(Node *const node, const std::string &lane_id, const std::string &road_id)
void GetEdgeForTest(Edge *const edge, const std::string &lane_id_1, const std::string &lane_id_2, const Edge::DirectionType &type)

◆ GetGraph3ForTest()

void apollo::routing::GetGraph3ForTest ( Graph graph)

在文件 topo_test_utils.cc128 行定义.

128 {
129 graph->set_hdmap_version(TEST_MAP_VERSION);
130 graph->set_hdmap_district(TEST_MAP_DISTRICT);
131 GetNodeForTest(graph->add_node(), TEST_L1, TEST_R1);
132 GetNodeForTest(graph->add_node(), TEST_L2, TEST_R1);
133 GetNodeForTest(graph->add_node(), TEST_L3, TEST_R2);
134 GetNodeForTest(graph->add_node(), TEST_L4, TEST_R2);
135 GetNodeForTest(graph->add_node(), TEST_L5, TEST_R3);
136 GetNodeForTest(graph->add_node(), TEST_L6, TEST_R3);
137
138 GetEdgeForTest(graph->add_edge(), TEST_L1, TEST_L2, Edge::RIGHT);
139 GetEdgeForTest(graph->add_edge(), TEST_L2, TEST_L1, Edge::LEFT);
140 GetEdgeForTest(graph->add_edge(), TEST_L3, TEST_L4, Edge::RIGHT);
141 GetEdgeForTest(graph->add_edge(), TEST_L4, TEST_L3, Edge::LEFT);
142 GetEdgeForTest(graph->add_edge(), TEST_L5, TEST_L6, Edge::RIGHT);
143 GetEdgeForTest(graph->add_edge(), TEST_L6, TEST_L5, Edge::LEFT);
144 GetEdgeForTest(graph->add_edge(), TEST_L1, TEST_L3, Edge::FORWARD);
145 GetEdgeForTest(graph->add_edge(), TEST_L3, TEST_L5, Edge::FORWARD);
146 GetEdgeForTest(graph->add_edge(), TEST_L2, TEST_L4, Edge::FORWARD);
147 GetEdgeForTest(graph->add_edge(), TEST_L4, TEST_L6, Edge::FORWARD);
148}

◆ GetGraphForTest()

void apollo::routing::GetGraphForTest ( Graph graph)

在文件 topo_test_utils.cc91 行定义.

91 {
92 graph->set_hdmap_version(TEST_MAP_VERSION);
93 graph->set_hdmap_district(TEST_MAP_DISTRICT);
94 GetNodeForTest(graph->add_node(), TEST_L1, TEST_R1);
95 GetNodeForTest(graph->add_node(), TEST_L2, TEST_R1);
96 GetNodeForTest(graph->add_node(), TEST_L3, TEST_R2);
97 GetNodeForTest(graph->add_node(), TEST_L4, TEST_R2);
98
99 GetEdgeForTest(graph->add_edge(), TEST_L1, TEST_L2, Edge::RIGHT);
100 GetEdgeForTest(graph->add_edge(), TEST_L2, TEST_L1, Edge::LEFT);
101 GetEdgeForTest(graph->add_edge(), TEST_L3, TEST_L4, Edge::RIGHT);
102 GetEdgeForTest(graph->add_edge(), TEST_L4, TEST_L3, Edge::LEFT);
103 GetEdgeForTest(graph->add_edge(), TEST_L1, TEST_L3, Edge::FORWARD);
104 GetEdgeForTest(graph->add_edge(), TEST_L2, TEST_L4, Edge::FORWARD);
105}

◆ GetLargestRange()

const NodeWithRange & apollo::routing::GetLargestRange ( const std::vector< NodeWithRange > &  node_vec)

在文件 result_generator.cc35 行定义.

36 {
37 ACHECK(!node_vec.empty());
38 size_t result_idx = 0;
39 double result_range_length = 0.0;
40 for (size_t i = 0; i < node_vec.size(); ++i) {
41 if (node_vec[i].Length() > result_range_length) {
42 result_range_length = node_vec[i].Length();
43 result_idx = i;
44 }
45 }
46 return node_vec[result_idx];
47}
#define ACHECK(cond)
Definition log.h:80

◆ GetNodeDetailForTest()

void apollo::routing::GetNodeDetailForTest ( Node *const  node,
const std::string &  lane_id,
const std::string &  road_id 
)

在文件 topo_test_utils.cc53 行定义.

54 {
55 node->set_lane_id(lane_id);
56 node->set_length(TEST_LANE_LENGTH);
57 node->set_road_id(road_id);
58 node->set_cost(TEST_LANE_COST);
59 AddCurve(node->mutable_central_curve());
60 auto* left_out = node->add_left_out();
61 left_out->mutable_start()->set_s(TEST_START_S);
62 left_out->mutable_end()->set_s(TEST_END_S);
63 auto* right_out = node->add_right_out();
64 right_out->mutable_start()->set_s(TEST_START_S);
65 right_out->mutable_end()->set_s(TEST_END_S);
66}

◆ GetNodeForTest()

void apollo::routing::GetNodeForTest ( Node *const  node,
const std::string &  lane_id,
const std::string &  road_id 
)

在文件 topo_test_utils.cc68 行定义.

69 {
70 node->set_lane_id(lane_id);
71 node->set_length(TEST_LANE_LENGTH);
72 node->set_road_id(road_id);
73 node->set_cost(TEST_LANE_COST);
74 auto* left_out = node->add_left_out();
75 left_out->mutable_start()->set_s(TEST_START_S);
76 left_out->mutable_end()->set_s(TEST_END_S);
77 auto* right_out = node->add_right_out();
78 right_out->mutable_start()->set_s(TEST_START_S);
79 right_out->mutable_end()->set_s(TEST_END_S);
80}

◆ IsCloseEnough()

bool apollo::routing::IsCloseEnough ( double  value_1,
double  value_2 
)

在文件 result_generator.cc30 行定义.

30 {
31 static constexpr double kEpsilon = 1e-6;
32 return std::fabs(value_1 - value_2) < kEpsilon;
33}

◆ LaneNodesToPassageRegion() [1/2]

void apollo::routing::LaneNodesToPassageRegion ( const std::vector< NodeWithRange > &  nodes,
Passage *const  passage 
)

在文件 result_generator.cc273 行定义.

274 {
275 return LaneNodesToPassageRegion(nodes.begin(), nodes.end(), passage);
276}
void LaneNodesToPassageRegion(const std::vector< NodeWithRange >::const_iterator begin, const std::vector< NodeWithRange >::const_iterator end, Passage *const passage)

◆ LaneNodesToPassageRegion() [2/2]

void apollo::routing::LaneNodesToPassageRegion ( const std::vector< NodeWithRange >::const_iterator  begin,
const std::vector< NodeWithRange >::const_iterator  end,
Passage *const  passage 
)

在文件 result_generator.cc261 行定义.

264 {
265 for (auto it = begin; it != end; ++it) {
266 LaneSegment* seg = passage->add_segment();
267 seg->set_id(it->LaneId());
268 seg->set_start_s(it->StartS());
269 seg->set_end_s(it->EndS());
270 }
271}

◆ PrintDebugInfo()

void apollo::routing::PrintDebugInfo ( const std::string &  road_id,
const std::vector< std::vector< NodeWithRange > > &  nodes 
)

在文件 result_generator.cc291 行定义.

292 {
293 AINFO << "road id: " << road_id;
294 for (size_t j = 0; j < nodes.size(); ++j) {
295 AINFO << "\tPassage " << j;
296 for (const auto& node : nodes[j]) {
297 AINFO << "\t\t" << node.LaneId() << " (" << node.StartS() << ", "
298 << node.EndS() << ")";
299 }
300 }
301}
#define AINFO
Definition log.h:42

变量说明

◆ S_GAP_FOR_BLACK

constexpr double apollo::routing::S_GAP_FOR_BLACK = 0.01
constexpr

在文件 black_list_range_generator.cc22 行定义.

◆ TEST_EDGE_COST

const double apollo::routing::TEST_EDGE_COST = 2.2

在文件 topo_test_utils.h42 行定义.

◆ TEST_END_S

const double apollo::routing::TEST_END_S = TEST_LANE_LENGTH

在文件 topo_test_utils.h46 行定义.

◆ TEST_L1

const char apollo::routing::TEST_L1[] = "L1"

在文件 topo_test_utils.h29 行定义.

◆ TEST_L2

const char apollo::routing::TEST_L2[] = "L2"

在文件 topo_test_utils.h30 行定义.

◆ TEST_L3

const char apollo::routing::TEST_L3[] = "L3"

在文件 topo_test_utils.h31 行定义.

◆ TEST_L4

const char apollo::routing::TEST_L4[] = "L4"

在文件 topo_test_utils.h32 行定义.

◆ TEST_L5

const char apollo::routing::TEST_L5[] = "L5"

在文件 topo_test_utils.h33 行定义.

◆ TEST_L6

const char apollo::routing::TEST_L6[] = "L6"

在文件 topo_test_utils.h34 行定义.

◆ TEST_LANE_COST

const double apollo::routing::TEST_LANE_COST = 1.1

在文件 topo_test_utils.h41 行定义.

◆ TEST_LANE_LENGTH

const double apollo::routing::TEST_LANE_LENGTH = 100.0

在文件 topo_test_utils.h40 行定义.

◆ TEST_MAP_DISTRICT

const char apollo::routing::TEST_MAP_DISTRICT[] = "yongfeng"

在文件 topo_test_utils.h27 行定义.

◆ TEST_MAP_VERSION

const char apollo::routing::TEST_MAP_VERSION[] = "1.0.1"

在文件 topo_test_utils.h26 行定义.

◆ TEST_MIDDLE_S

const double apollo::routing::TEST_MIDDLE_S = 0.0

在文件 topo_test_utils.h45 行定义.

◆ TEST_R1

const char apollo::routing::TEST_R1[] = "R1"

在文件 topo_test_utils.h36 行定义.

◆ TEST_R2

const char apollo::routing::TEST_R2[] = "R2"

在文件 topo_test_utils.h37 行定义.

◆ TEST_R3

const char apollo::routing::TEST_R3[] = "R3"

在文件 topo_test_utils.h38 行定义.

◆ TEST_START_S

const double apollo::routing::TEST_START_S = 0.0

在文件 topo_test_utils.h44 行定义.