Apollo  6.0
Open source self driving car software
proto_organizer.h
Go to the documentation of this file.
1 /* Copyright 2017 The Apollo Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7  http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 =========================================================================*/
15 #pragma once
16 
17 #include <string>
18 #include <unordered_map>
19 #include <utility>
20 #include <vector>
21 
23 
25 #include "modules/map/proto/map.pb.h"
26 
27 namespace apollo {
28 namespace hdmap {
29 namespace adapter {
30 
31 struct ProtoData {
33  std::unordered_map<std::string, PbLane> pb_lanes;
34  std::unordered_map<std::string, PbRoad> pb_roads;
35  std::unordered_map<std::string, PbCrosswalk> pb_crosswalks;
36  std::unordered_map<std::string, PbClearArea> pb_clear_areas;
37  std::unordered_map<std::string, PbSpeedBump> pb_speed_bumps;
38  std::unordered_map<std::string, PbJunction> pb_junction;
39  std::unordered_map<std::string, PbSignal> pb_signals;
40  std::unordered_map<std::string, PbStopSign> pb_stop_signs;
41  std::unordered_map<std::string, PbYieldSign> pb_yield_signs;
42  std::unordered_map<std::string, PbOverlap> pb_overlaps;
43  std::unordered_map<std::string, PbJunction> pb_junctions;
44  std::unordered_map<std::string, StopLineInternal> pb_stop_lines;
45  std::unordered_map<std::string, PbParkingSpace> pb_parking_spaces;
46  std::unordered_map<std::string, PbPNCJunction> pb_pnc_junctions;
47  std::unordered_map<std::string, PbRSU> pb_rsus;
48 };
49 
51  public:
52  void GetRoadElements(std::vector<RoadInternal>* roads);
53  void GetJunctionElements(const std::vector<JunctionInternal>& junctions);
54  void GetOverlapElements(const std::vector<RoadInternal>& roads,
55  const std::vector<JunctionInternal>& junctions);
56  void GetObjectElements(const ObjectInternal& objects);
57  void OutputData(apollo::hdmap::Map* pb_map);
58 
59  private:
60  void GetLaneObjectOverlapElements(
61  const std::string& lane_id,
62  const std::vector<OverlapWithLane>& overlap_with_lanes);
63  void GetLaneSignalOverlapElements(
64  const std::string& lane_id,
65  const std::vector<OverlapWithLane>& overlap_with_lanes);
66  void GetLaneJunctionOverlapElements(
67  const std::string& lane_id,
68  const std::vector<OverlapWithLane>& overlap_with_lanes);
69  void GetLaneLaneOverlapElements(
70  const std::unordered_map<std::pair<std::string, std::string>,
72  lane_lane_overlaps);
73  void GetJunctionObjectOverlapElements(
74  const std::vector<JunctionInternal>& junctions);
75 
76  private:
77  ProtoData proto_data_;
78 };
79 
80 } // namespace adapter
81 } // namespace hdmap
82 } // namespace apollo
std::unordered_map< std::string, PbPNCJunction > pb_pnc_junctions
Definition: proto_organizer.h:46
std::unordered_map< std::string, PbRSU > pb_rsus
Definition: proto_organizer.h:47
std::unordered_map< std::string, PbLane > pb_lanes
Definition: proto_organizer.h:33
std::unordered_map< std::string, PbStopSign > pb_stop_signs
Definition: proto_organizer.h:40
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::unordered_map< std::string, PbYieldSign > pb_yield_signs
Definition: proto_organizer.h:41
Definition: util.h:54
Definition: proto_organizer.h:31
std::unordered_map< std::string, PbSpeedBump > pb_speed_bumps
Definition: proto_organizer.h:37
Definition: common_define.h:156
Definition: common_define.h:92
std::unordered_map< std::string, StopLineInternal > pb_stop_lines
Definition: proto_organizer.h:44
PbHeader header
Definition: proto_organizer.h:32
std::unordered_map< std::string, PbCrosswalk > pb_crosswalks
Definition: proto_organizer.h:35
std::unordered_map< std::string, PbSignal > pb_signals
Definition: proto_organizer.h:39
Definition: proto_organizer.h:50
std::unordered_map< std::string, PbOverlap > pb_overlaps
Definition: proto_organizer.h:42
std::unordered_map< std::string, PbClearArea > pb_clear_areas
Definition: proto_organizer.h:36
std::unordered_map< std::string, PbJunction > pb_junctions
Definition: proto_organizer.h:43
std::unordered_map< std::string, PbParkingSpace > pb_parking_spaces
Definition: proto_organizer.h:45
std::unordered_map< std::string, PbJunction > pb_junction
Definition: proto_organizer.h:38
apollo::hdmap::Header PbHeader
Definition: common_define.h:28
Some util functions.
std::unordered_map< std::string, PbRoad > pb_roads
Definition: proto_organizer.h:34