Apollo  6.0
Open source self driving car software
result_generator.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 
17 #pragma once
18 
19 #include <string>
20 #include <utility>
21 #include <vector>
22 
23 #include "modules/routing/proto/routing.pb.h"
24 
27 
28 namespace apollo {
29 namespace routing {
30 
32  public:
33  ResultGenerator() = default;
34  ~ResultGenerator() = default;
35 
36  bool GeneratePassageRegion(const std::string& map_version,
37  const RoutingRequest& request,
38  const std::vector<NodeWithRange>& nodes,
39  const TopoRangeManager& range_manager,
40  RoutingResponse* const result);
41 
42  private:
43  struct PassageInfo {
44  std::vector<NodeWithRange> nodes;
45  ChangeLaneType change_lane_type;
46  PassageInfo() = default;
47  PassageInfo(const std::vector<NodeWithRange>& _nodes,
48  ChangeLaneType _change_lane_type)
49  : nodes(_nodes), change_lane_type(_change_lane_type) {}
50  };
51 
52  bool GeneratePassageRegion(const std::vector<NodeWithRange>& nodes,
53  const TopoRangeManager& range_manager,
54  RoutingResponse* const result);
55 
56  void CreateRoadSegments(const std::vector<PassageInfo>& passages,
57  RoutingResponse* result);
58 
59  void AddRoadSegment(const std::vector<PassageInfo>& passages,
60  const std::pair<std::size_t, std::size_t>& start_index,
61  const std::pair<std::size_t, std::size_t>& end_index,
62  RoutingResponse* result);
63  void ExtendPassages(const TopoRangeManager& range_manager,
64  std::vector<PassageInfo>* const passages);
65  bool ExtractBasicPassages(const std::vector<NodeWithRange>& nodes,
66  std::vector<PassageInfo>* const passsages);
67  void ExtendBackward(const TopoRangeManager& range_manager,
68  const PassageInfo& prev_passage,
69  PassageInfo* const curr_passage);
70  void ExtendForward(const TopoRangeManager& range_manager,
71  const PassageInfo& next_passage,
72  PassageInfo* const curr_passage);
73  bool IsReachableFromWithChangeLane(const TopoNode* from_node,
74  const PassageInfo& to_nodes,
75  NodeWithRange* reachable_node);
76  bool IsReachableToWithChangeLane(const TopoNode* from_node,
77  const PassageInfo& to_nodes,
78  NodeWithRange* reachable_node);
79 };
80 
81 } // namespace routing
82 } // namespace apollo
Definition: topo_node.h:32
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Definition: topo_range_manager.h:27
Definition: result_generator.h:31
Definition: node_with_range.h:26
bool GeneratePassageRegion(const std::string &map_version, const RoutingRequest &request, const std::vector< NodeWithRange > &nodes, const TopoRangeManager &range_manager, RoutingResponse *const result)