Apollo 11.0
自动驾驶开放平台
hdmap_impl.cc
浏览该文件的文档.
1/* Copyright 2017 The Apollo Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14=========================================================================*/
15
17
18#include <algorithm>
19#include <limits>
20#include <mutex>
21#include <set>
22#include <unordered_set>
23
24#include "absl/strings/match.h"
25
26
27#include "cyber/common/file.h"
30
31namespace apollo {
32namespace hdmap {
33namespace {
34
38
39// default lanes search radius in GetForwardNearestSignalsOnLane
40constexpr double kLanesSearchRange = 10.0;
41// backward search distance in GetForwardNearestSignalsOnLane
42constexpr int kBackwardDistance = 4;
43
44} // namespace
45
46Id HDMapImpl::CreateHDMapId(const std::string& string_id) const {
47 Id id;
48 id.set_id(string_id);
49 return id;
50}
51
52int HDMapImpl::LoadMapFromFile(const std::string& map_filename) {
53 Clear();
54 // TODO(All) seems map_ can be changed to a local variable of this
55 // function, but test will fail if I do so. if so.
56 if (absl::EndsWith(map_filename, ".xml")) {
57 if (!adapter::OpendriveAdapter::LoadData(map_filename, &map_)) {
58 return -1;
59 }
60 } else if (!cyber::common::GetProtoFromFile(map_filename, &map_)) {
61 return -1;
62 }
63
64 return LoadMapFromProto(map_);
65}
66
67bool HDMapImpl::GetMapHeader(Header* map_header) const {
68 if (!map_.has_header()) {
69 return false;
70 }
71 *map_header = map_.header();
72 return true;
73}
74
75int HDMapImpl::LoadMapFromProto(const Map& map_proto) {
76 if (&map_proto != &map_) { // avoid an unnecessary copy
77 Clear();
78 map_ = map_proto;
79 }
80 for (const auto& lane : map_.lane()) {
81 lane_table_[lane.id().id()].reset(new LaneInfo(lane));
82 }
83 for (const auto& junction : map_.junction()) {
84 junction_table_[junction.id().id()].reset(new JunctionInfo(junction));
85 }
86
87 for (const auto& ad_area : map_.ad_area()) {
88 area_table_[ad_area.id().id()].reset(new AreaInfo(ad_area));
89 }
90
91 for (const auto& BarrierGate : map_.barrier_gate()) {
92 barrier_gate_table_[BarrierGate.id().id()].reset(
94 }
95
96 for (const auto& signal : map_.signal()) {
97 signal_table_[signal.id().id()].reset(new SignalInfo(signal));
98 }
99 for (const auto& crosswalk : map_.crosswalk()) {
100 crosswalk_table_[crosswalk.id().id()].reset(new CrosswalkInfo(crosswalk));
101 }
102 for (const auto& stop_sign : map_.stop_sign()) {
103 stop_sign_table_[stop_sign.id().id()].reset(new StopSignInfo(stop_sign));
104 }
105 for (const auto& yield_sign : map_.yield()) {
106 yield_sign_table_[yield_sign.id().id()].reset(
107 new YieldSignInfo(yield_sign));
108 }
109 for (const auto& clear_area : map_.clear_area()) {
110 clear_area_table_[clear_area.id().id()].reset(
111 new ClearAreaInfo(clear_area));
112 }
113 for (const auto& speed_bump : map_.speed_bump()) {
114 speed_bump_table_[speed_bump.id().id()].reset(
115 new SpeedBumpInfo(speed_bump));
116 }
117 for (const auto& parking_space : map_.parking_space()) {
118 parking_space_table_[parking_space.id().id()].reset(
119 new ParkingSpaceInfo(parking_space));
120 }
121 for (const auto& pnc_junction : map_.pnc_junction()) {
122 pnc_junction_table_[pnc_junction.id().id()].reset(
123 new PNCJunctionInfo(pnc_junction));
124 }
125 for (const auto& rsu : map_.rsu()) {
126 rsu_table_[rsu.id().id()].reset(new RSUInfo(rsu));
127 }
128 for (const auto& overlap : map_.overlap()) {
129 overlap_table_[overlap.id().id()].reset(new OverlapInfo(overlap));
130 }
131
132 for (const auto& road : map_.road()) {
133 road_table_[road.id().id()].reset(new RoadInfo(road));
134 }
135 for (const auto& rsu : map_.rsu()) {
136 rsu_table_[rsu.id().id()].reset(new RSUInfo(rsu));
137 }
138 for (const auto& road_ptr_pair : road_table_) {
139 const auto& road_id = road_ptr_pair.second->id();
140 for (const auto& road_section : road_ptr_pair.second->sections()) {
141 const auto& section_id = road_section.id();
142 for (const auto& lane_id : road_section.lane_id()) {
143 auto iter = lane_table_.find(lane_id.id());
144 if (iter != lane_table_.end()) {
145 iter->second->set_road_id(road_id);
146 iter->second->set_section_id(section_id);
147 } else {
148 AFATAL << "Unknown lane id: " << lane_id.id();
149 }
150 }
151 }
152 }
153 for (const auto& lane_ptr_pair : lane_table_) {
154 lane_ptr_pair.second->PostProcess(*this);
155 }
156 for (const auto& junction_ptr_pair : junction_table_) {
157 junction_ptr_pair.second->PostProcess(*this);
158 }
159 for (const auto& stop_sign_ptr_pair : stop_sign_table_) {
160 stop_sign_ptr_pair.second->PostProcess(*this);
161 }
162 for (const auto& area_ptr_pair : area_table_) {
163 area_ptr_pair.second->PostProcess(*this);
164 }
165
166 BuildLaneSegmentKDTree();
167 BuildJunctionPolygonKDTree();
168 BuildSignalSegmentKDTree();
169 BuildCrosswalkPolygonKDTree();
170 BuildStopSignSegmentKDTree();
171 BuildYieldSignSegmentKDTree();
172 BuildClearAreaPolygonKDTree();
173 BuildSpeedBumpSegmentKDTree();
174 BuildParkingSpacePolygonKDTree();
175 BuildPNCJunctionPolygonKDTree();
176 BuildAreaPolygonKDTree();
177 BuildBarrierGateSegmentKDTree();
178 return 0;
179}
180
182 LaneTable::const_iterator it = lane_table_.find(id.id());
183 return it != lane_table_.end() ? it->second : nullptr;
184}
185
187 JunctionTable::const_iterator it = junction_table_.find(id.id());
188 return it != junction_table_.end() ? it->second : nullptr;
189}
190
192 AreaTable::const_iterator it = area_table_.find(id.id());
193 return it != area_table_.end() ? it->second : nullptr;
194}
195
197 SignalTable::const_iterator it = signal_table_.find(id.id());
198 return it != signal_table_.end() ? it->second : nullptr;
199}
200
202 BarrierGateTable::const_iterator it = barrier_gate_table_.find(id.id());
203 return it != barrier_gate_table_.end() ? it->second : nullptr;
204}
205
207 CrosswalkTable::const_iterator it = crosswalk_table_.find(id.id());
208 return it != crosswalk_table_.end() ? it->second : nullptr;
209}
210
212 StopSignTable::const_iterator it = stop_sign_table_.find(id.id());
213 return it != stop_sign_table_.end() ? it->second : nullptr;
214}
215
217 YieldSignTable::const_iterator it = yield_sign_table_.find(id.id());
218 return it != yield_sign_table_.end() ? it->second : nullptr;
219}
220
222 ClearAreaTable::const_iterator it = clear_area_table_.find(id.id());
223 return it != clear_area_table_.end() ? it->second : nullptr;
224}
225
227 SpeedBumpTable::const_iterator it = speed_bump_table_.find(id.id());
228 return it != speed_bump_table_.end() ? it->second : nullptr;
229}
230
232 OverlapTable::const_iterator it = overlap_table_.find(id.id());
233 return it != overlap_table_.end() ? it->second : nullptr;
234}
235
237 RoadTable::const_iterator it = road_table_.find(id.id());
238 return it != road_table_.end() ? it->second : nullptr;
239}
240
242 ParkingSpaceTable::const_iterator it = parking_space_table_.find(id.id());
243 return it != parking_space_table_.end() ? it->second : nullptr;
244}
245
247 PNCJunctionTable::const_iterator it = pnc_junction_table_.find(id.id());
248 return it != pnc_junction_table_.end() ? it->second : nullptr;
249}
250
252 RSUTable::const_iterator it = rsu_table_.find(id.id());
253 return it != rsu_table_.end() ? it->second : nullptr;
254}
255int HDMapImpl::GetLanes(const PointENU& point, double distance,
256 std::vector<LaneInfoConstPtr>* lanes) const {
257 return GetLanes({point.x(), point.y()}, distance, lanes);
258}
259
260int HDMapImpl::GetLanes(const Vec2d& point, double distance,
261 std::vector<LaneInfoConstPtr>* lanes) const {
262 if (lanes == nullptr || lane_segment_kdtree_ == nullptr) {
263 return -1;
264 }
265 lanes->clear();
266 std::vector<std::string> ids;
267 const int status =
268 SearchObjects(point, distance, *lane_segment_kdtree_, &ids);
269 if (status < 0) {
270 return status;
271 }
272 for (const auto& id : ids) {
273 lanes->emplace_back(GetLaneById(CreateHDMapId(id)));
274 }
275 return 0;
276}
277
278int HDMapImpl::GetRoads(const PointENU& point, double distance,
279 std::vector<RoadInfoConstPtr>* roads) const {
280 return GetRoads({point.x(), point.y()}, distance, roads);
281}
282
283int HDMapImpl::GetRoads(const Vec2d& point, double distance,
284 std::vector<RoadInfoConstPtr>* roads) const {
285 std::vector<LaneInfoConstPtr> lanes;
286 if (GetLanes(point, distance, &lanes) != 0) {
287 return -1;
288 }
289 std::unordered_set<std::string> road_ids;
290 for (auto& lane : lanes) {
291 if (!lane->road_id().id().empty()) {
292 road_ids.insert(lane->road_id().id());
293 }
294 }
295
296 for (auto& road_id : road_ids) {
298 CHECK_NOTNULL(road);
299 roads->push_back(road);
300 }
301
302 return 0;
303}
304
306 const PointENU& point, double distance,
307 std::vector<JunctionInfoConstPtr>* junctions) const {
308 return GetJunctions({point.x(), point.y()}, distance, junctions);
309}
310
312 const Vec2d& point, double distance,
313 std::vector<JunctionInfoConstPtr>* junctions) const {
314 if (junctions == nullptr || junction_polygon_kdtree_ == nullptr) {
315 return -1;
316 }
317 junctions->clear();
318 std::vector<std::string> ids;
319 const int status =
320 SearchObjects(point, distance, *junction_polygon_kdtree_, &ids);
321 if (status < 0) {
322 return status;
323 }
324 for (const auto& id : ids) {
325 junctions->emplace_back(GetJunctionById(CreateHDMapId(id)));
326 }
327 return 0;
328}
329
330int HDMapImpl::GetAreas(const PointENU& point, double distance,
331 std::vector<AreaInfoConstPtr>* areas) const {
332 return GetAreas({point.x(), point.y()}, distance, areas);
333}
334
335int HDMapImpl::GetAreas(const Vec2d& point, double distance,
336 std::vector<AreaInfoConstPtr>* areas) const {
337 if (areas == nullptr || area_polygon_kdtree_ == nullptr) {
338 return -1;
339 }
340 areas->clear();
341 std::vector<std::string> ids;
342 const int status =
343 SearchObjects(point, distance, *area_polygon_kdtree_, &ids);
344 if (status < 0) {
345 return status;
346 }
347 for (const auto& id : ids) {
348 areas->emplace_back(GetAreaById(CreateHDMapId(id)));
349 }
350 return 0;
351}
352
353int HDMapImpl::GetSignals(const PointENU& point, double distance,
354 std::vector<SignalInfoConstPtr>* signals) const {
355 return GetSignals({point.x(), point.y()}, distance, signals);
356}
357
358int HDMapImpl::GetSignals(const Vec2d& point, double distance,
359 std::vector<SignalInfoConstPtr>* signals) const {
360 if (signals == nullptr || signal_segment_kdtree_ == nullptr) {
361 return -1;
362 }
363 signals->clear();
364 std::vector<std::string> ids;
365 const int status =
366 SearchObjects(point, distance, *signal_segment_kdtree_, &ids);
367 if (status < 0) {
368 return status;
369 }
370 for (const auto& id : ids) {
371 signals->emplace_back(GetSignalById(CreateHDMapId(id)));
372 }
373 return 0;
374}
375
377 const PointENU& point, double distance,
378 std::vector<BarrierGateInfoConstPtr>* barrier_gates) const {
379 return GetBarrierGates({point.x(), point.y()}, distance, barrier_gates);
380}
381
383 const Vec2d& point, double distance,
384 std::vector<BarrierGateInfoConstPtr>* barrier_gates) const {
385 if (barrier_gates == nullptr || barrier_gate_segment_kdtree_ == nullptr) {
386 return -1;
387 }
388 barrier_gates->clear();
389 std::vector<std::string> ids;
390 const int status =
391 SearchObjects(point, distance, *barrier_gate_segment_kdtree_, &ids);
392 if (status < 0) {
393 return status;
394 }
395 for (const auto& id : ids) {
396 barrier_gates->emplace_back(GetBarrierGateById(CreateHDMapId(id)));
397 }
398 return 0;
399}
400
402 const PointENU& point, double distance,
403 std::vector<CrosswalkInfoConstPtr>* crosswalks) const {
404 return GetCrosswalks({point.x(), point.y()}, distance, crosswalks);
405}
406
408 const Vec2d& point, double distance,
409 std::vector<CrosswalkInfoConstPtr>* crosswalks) const {
410 if (crosswalks == nullptr || crosswalk_polygon_kdtree_ == nullptr) {
411 return -1;
412 }
413 crosswalks->clear();
414 std::vector<std::string> ids;
415 const int status =
416 SearchObjects(point, distance, *crosswalk_polygon_kdtree_, &ids);
417 if (status < 0) {
418 return status;
419 }
420 for (const auto& id : ids) {
421 crosswalks->emplace_back(GetCrosswalkById(CreateHDMapId(id)));
422 }
423 return 0;
424}
425
427 const PointENU& point, double distance,
428 std::vector<StopSignInfoConstPtr>* stop_signs) const {
429 return GetStopSigns({point.x(), point.y()}, distance, stop_signs);
430}
431
433 const Vec2d& point, double distance,
434 std::vector<StopSignInfoConstPtr>* stop_signs) const {
435 if (stop_signs == nullptr || stop_sign_segment_kdtree_ == nullptr) {
436 return -1;
437 }
438 stop_signs->clear();
439 std::vector<std::string> ids;
440 const int status =
441 SearchObjects(point, distance, *stop_sign_segment_kdtree_, &ids);
442 if (status < 0) {
443 return status;
444 }
445 for (const auto& id : ids) {
446 stop_signs->emplace_back(GetStopSignById(CreateHDMapId(id)));
447 }
448 return 0;
449}
450
452 const PointENU& point, double distance,
453 std::vector<YieldSignInfoConstPtr>* yield_signs) const {
454 return GetYieldSigns({point.x(), point.y()}, distance, yield_signs);
455}
456
458 const Vec2d& point, double distance,
459 std::vector<YieldSignInfoConstPtr>* yield_signs) const {
460 if (yield_signs == nullptr || yield_sign_segment_kdtree_ == nullptr) {
461 return -1;
462 }
463 yield_signs->clear();
464 std::vector<std::string> ids;
465 const int status =
466 SearchObjects(point, distance, *yield_sign_segment_kdtree_, &ids);
467 if (status < 0) {
468 return status;
469 }
470 for (const auto& id : ids) {
471 yield_signs->emplace_back(GetYieldSignById(CreateHDMapId(id)));
472 }
473
474 return 0;
475}
476
478 const PointENU& point, double distance,
479 std::vector<ClearAreaInfoConstPtr>* clear_areas) const {
480 return GetClearAreas({point.x(), point.y()}, distance, clear_areas);
481}
482
484 const Vec2d& point, double distance,
485 std::vector<ClearAreaInfoConstPtr>* clear_areas) const {
486 if (clear_areas == nullptr || clear_area_polygon_kdtree_ == nullptr) {
487 return -1;
488 }
489 clear_areas->clear();
490 std::vector<std::string> ids;
491 const int status =
492 SearchObjects(point, distance, *clear_area_polygon_kdtree_, &ids);
493 if (status < 0) {
494 return status;
495 }
496 for (const auto& id : ids) {
497 clear_areas->emplace_back(GetClearAreaById(CreateHDMapId(id)));
498 }
499
500 return 0;
501}
502
504 const PointENU& point, double distance,
505 std::vector<SpeedBumpInfoConstPtr>* speed_bumps) const {
506 return GetSpeedBumps({point.x(), point.y()}, distance, speed_bumps);
507}
508
510 const Vec2d& point, double distance,
511 std::vector<SpeedBumpInfoConstPtr>* speed_bumps) const {
512 if (speed_bumps == nullptr || speed_bump_segment_kdtree_ == nullptr) {
513 return -1;
514 }
515 speed_bumps->clear();
516 std::vector<std::string> ids;
517 const int status =
518 SearchObjects(point, distance, *speed_bump_segment_kdtree_, &ids);
519 if (status < 0) {
520 return status;
521 }
522 for (const auto& id : ids) {
523 speed_bumps->emplace_back(GetSpeedBumpById(CreateHDMapId(id)));
524 }
525
526 return 0;
527}
528
530 const PointENU& point, double distance,
531 std::vector<ParkingSpaceInfoConstPtr>* parking_spaces) const {
532 return GetParkingSpaces({point.x(), point.y()}, distance, parking_spaces);
533}
534
536 const Vec2d& point, double distance,
537 std::vector<ParkingSpaceInfoConstPtr>* parking_spaces) const {
538 if (parking_spaces == nullptr || parking_space_polygon_kdtree_ == nullptr) {
539 return -1;
540 }
541 parking_spaces->clear();
542 std::vector<std::string> ids;
543 const int status =
544 SearchObjects(point, distance, *parking_space_polygon_kdtree_, &ids);
545 if (status < 0) {
546 return status;
547 }
548 for (const auto& id : ids) {
549 parking_spaces->emplace_back(GetParkingSpaceById(CreateHDMapId(id)));
550 }
551
552 return 0;
553}
554
556 const apollo::common::PointENU& point, double distance,
557 std::vector<PNCJunctionInfoConstPtr>* pnc_junctions) const {
558 return GetPNCJunctions({point.x(), point.y()}, distance, pnc_junctions);
559}
560
562 const apollo::common::math::Vec2d& point, double distance,
563 std::vector<PNCJunctionInfoConstPtr>* pnc_junctions) const {
564 if (pnc_junctions == nullptr || pnc_junction_polygon_kdtree_ == nullptr) {
565 return -1;
566 }
567 pnc_junctions->clear();
568
569 std::vector<std::string> ids;
570 const int status =
571 SearchObjects(point, distance, *pnc_junction_polygon_kdtree_, &ids);
572 if (status < 0) {
573 return status;
574 }
575
576 for (const auto& id : ids) {
577 pnc_junctions->emplace_back(GetPNCJunctionById(CreateHDMapId(id)));
578 }
579
580 return 0;
581}
582
584 const double distance,
585 LaneInfoConstPtr* nearest_lane,
586 double* nearest_s,
587 double* nearest_l) const {
588 return GetNearestLaneWithDistance({point.x(), point.y()}, distance,
589 nearest_lane, nearest_s, nearest_l);
590}
591
593 const apollo::common::math::Vec2d& point, const double distance,
594 LaneInfoConstPtr* nearest_lane, double* nearest_s,
595 double* nearest_l) const {
596 CHECK_NOTNULL(nearest_lane);
597 CHECK_NOTNULL(nearest_s);
598 CHECK_NOTNULL(nearest_l);
599 const auto* segment_object = lane_segment_kdtree_->GetNearestObject(point);
600 if (segment_object == nullptr) {
601 return -1;
602 }
603 const Id& lane_id = segment_object->object()->id();
604 *nearest_lane = GetLaneById(lane_id);
605 ACHECK(*nearest_lane);
606 const int id = segment_object->id();
607 const auto& segment = (*nearest_lane)->segments()[id];
608 Vec2d nearest_pt;
609 double apart_distance = segment.DistanceTo(point, &nearest_pt);
610
611 if (apart_distance > distance) {
612 return -1;
613 }
614
615 *nearest_s = (*nearest_lane)->accumulate_s()[id] +
616 nearest_pt.DistanceTo(segment.start());
617 *nearest_l = segment.unit_direction().CrossProd(point - segment.start());
618
619 return 0;
620}
621
622int HDMapImpl::GetNearestLane(const PointENU& point,
623 LaneInfoConstPtr* nearest_lane, double* nearest_s,
624 double* nearest_l) const {
625 return GetNearestLane({point.x(), point.y()}, nearest_lane, nearest_s,
626 nearest_l);
627}
628
629int HDMapImpl::GetNearestLane(const Vec2d& point,
630 LaneInfoConstPtr* nearest_lane, double* nearest_s,
631 double* nearest_l) const {
632 CHECK_NOTNULL(nearest_lane);
633 CHECK_NOTNULL(nearest_s);
634 CHECK_NOTNULL(nearest_l);
635 const auto* segment_object = lane_segment_kdtree_->GetNearestObject(point);
636 if (segment_object == nullptr) {
637 return -1;
638 }
639 const Id& lane_id = segment_object->object()->id();
640 *nearest_lane = GetLaneById(lane_id);
641 ACHECK(*nearest_lane);
642 const int id = segment_object->id();
643 const auto& segment = (*nearest_lane)->segments()[id];
644 Vec2d nearest_pt;
645 segment.DistanceTo(point, &nearest_pt);
646 *nearest_s = (*nearest_lane)->accumulate_s()[id] +
647 nearest_pt.DistanceTo(segment.start());
648 *nearest_l = segment.unit_direction().CrossProd(point - segment.start());
649
650 return 0;
651}
652
654 const PointENU& point, const double distance, const double central_heading,
655 const double max_heading_difference, LaneInfoConstPtr* nearest_lane,
656 double* nearest_s, double* nearest_l) const {
657 return GetNearestLaneWithHeading({point.x(), point.y()}, distance,
658 central_heading, max_heading_difference,
659 nearest_lane, nearest_s, nearest_l);
660}
661
663 const Vec2d& point, const double distance, const double central_heading,
664 const double max_heading_difference, LaneInfoConstPtr* nearest_lane,
665 double* nearest_s, double* nearest_l) const {
666 CHECK_NOTNULL(nearest_lane);
667 CHECK_NOTNULL(nearest_s);
668 CHECK_NOTNULL(nearest_l);
669
670 std::vector<LaneInfoConstPtr> lanes;
671 if (GetLanesWithHeading(point, distance, central_heading,
672 max_heading_difference, &lanes) != 0) {
673 return -1;
674 }
675
676 double s = 0;
677 size_t s_index = 0;
678 Vec2d map_point;
679 double min_distance = distance;
680 for (const auto& lane : lanes) {
681 double s_offset = 0.0;
682 int s_offset_index = 0;
683 double distance =
684 lane->DistanceTo(point, &map_point, &s_offset, &s_offset_index);
685 if (distance < min_distance) {
686 min_distance = distance;
687 *nearest_lane = lane;
688 s = s_offset;
689 s_index = s_offset_index;
690 }
691 }
692
693 if (*nearest_lane == nullptr) {
694 return -1;
695 }
696
697 *nearest_s = s;
698 int segment_index = static_cast<int>(
699 std::min(s_index, (*nearest_lane)->segments().size() - 1));
700 const auto& segment_2d = (*nearest_lane)->segments()[segment_index];
701 *nearest_l =
702 segment_2d.unit_direction().CrossProd(point - segment_2d.start());
703
704 return 0;
705}
706
707int HDMapImpl::GetLanesWithHeading(const PointENU& point, const double distance,
708 const double central_heading,
709 const double max_heading_difference,
710 std::vector<LaneInfoConstPtr>* lanes) const {
711 return GetLanesWithHeading({point.x(), point.y()}, distance, central_heading,
712 max_heading_difference, lanes);
713}
714
715int HDMapImpl::GetLanesWithHeading(const Vec2d& point, const double distance,
716 const double central_heading,
717 const double max_heading_difference,
718 std::vector<LaneInfoConstPtr>* lanes) const {
719 CHECK_NOTNULL(lanes);
720 std::vector<LaneInfoConstPtr> all_lanes;
721 const int status = GetLanes(point, distance, &all_lanes);
722 if (status < 0 || all_lanes.empty()) {
723 return -1;
724 }
725
726 lanes->clear();
727 for (auto& lane : all_lanes) {
728 Vec2d proj_pt(0.0, 0.0);
729 double s_offset = 0.0;
730 int s_offset_index = 0;
731 double dis = lane->DistanceTo(point, &proj_pt, &s_offset, &s_offset_index);
732 if (dis <= distance) {
733 double heading_diff =
734 fabs(lane->headings()[s_offset_index] - central_heading);
735 if (fabs(apollo::common::math::NormalizeAngle(heading_diff)) <=
736 max_heading_difference) {
737 lanes->push_back(lane);
738 }
739 }
740 }
741
742 return 0;
743}
744
746 const PointENU& point, double radius,
747 std::vector<RoadROIBoundaryPtr>* road_boundaries,
748 std::vector<JunctionBoundaryPtr>* junctions) const {
749 CHECK_NOTNULL(road_boundaries);
750 CHECK_NOTNULL(junctions);
751
752 road_boundaries->clear();
753 junctions->clear();
754
755 std::vector<LaneInfoConstPtr> lanes;
756 if (GetLanes(point, radius, &lanes) != 0 || lanes.empty()) {
757 return -1;
758 }
759
760 std::unordered_set<std::string> junction_id_set;
761 std::unordered_set<std::string> road_section_id_set;
762 for (const auto& lane : lanes) {
763 const auto road_id = lane->road_id();
764 const auto section_id = lane->section_id();
765 std::string unique_id = road_id.id() + section_id.id();
766 if (road_section_id_set.count(unique_id) > 0) {
767 continue;
768 }
769 road_section_id_set.insert(unique_id);
770 const auto road_ptr = GetRoadById(road_id);
771 if (road_ptr == nullptr) {
772 AERROR << "road id [" << road_id.id() << "] is not found.";
773 continue;
774 }
775 if (road_ptr->has_junction_id()) {
776 const Id junction_id = road_ptr->junction_id();
777 if (junction_id_set.count(junction_id.id()) > 0) {
778 continue;
779 }
780 junction_id_set.insert(junction_id.id());
781 JunctionBoundaryPtr junction_boundary_ptr(new JunctionBoundary());
782 junction_boundary_ptr->junction_info = GetJunctionById(junction_id);
783 if (junction_boundary_ptr->junction_info == nullptr) {
784 AERROR << "junction id [" << junction_id.id() << "] is not found.";
785 continue;
786 }
787 junctions->push_back(junction_boundary_ptr);
788 } else {
789 RoadROIBoundaryPtr road_boundary_ptr(new RoadROIBoundary());
790 road_boundary_ptr->mutable_id()->CopyFrom(road_ptr->id());
791 for (const auto& section : road_ptr->sections()) {
792 if (section.id().id() == section_id.id()) {
793 road_boundary_ptr->add_road_boundaries()->CopyFrom(
794 section.boundary());
795 }
796 }
797 road_boundaries->push_back(road_boundary_ptr);
798 }
799 }
800
801 return 0;
802}
803
805 const PointENU& point, double radius,
806 std::vector<RoadRoiPtr>* road_boundaries,
807 std::vector<JunctionInfoConstPtr>* junctions) const {
808 if (road_boundaries == nullptr || junctions == nullptr) {
809 AERROR << "the pointer in parameter is null";
810 return -1;
811 }
812 road_boundaries->clear();
813 junctions->clear();
814 std::set<std::string> junction_id_set;
815 std::vector<RoadInfoConstPtr> roads;
816 if (GetRoads(point, radius, &roads) != 0) {
817 AERROR << "can not get roads in the range.";
818 return -1;
819 }
820 for (const auto& road_ptr : roads) {
821 if (road_ptr->has_junction_id()) {
822 JunctionInfoConstPtr junction_ptr =
823 GetJunctionById(road_ptr->junction_id());
824 if (junction_id_set.find(junction_ptr->id().id()) ==
825 junction_id_set.end()) {
826 junctions->push_back(junction_ptr);
827 junction_id_set.insert(junction_ptr->id().id());
828 }
829 } else {
830 RoadRoiPtr road_boundary_ptr(new RoadRoi());
831 const std::vector<apollo::hdmap::RoadBoundary>& temp_road_boundaries =
832 road_ptr->GetBoundaries();
833 road_boundary_ptr->id = road_ptr->id();
834 for (const auto& temp_road_boundary : temp_road_boundaries) {
835 apollo::hdmap::BoundaryPolygon boundary_polygon =
836 temp_road_boundary.outer_polygon();
837 for (const auto& edge : boundary_polygon.edge()) {
839 for (const auto& s : edge.curve().segment()) {
840 for (const auto& p : s.line_segment().point()) {
841 road_boundary_ptr->left_boundary.line_points.push_back(p);
842 }
843 }
844 }
846 for (const auto& s : edge.curve().segment()) {
847 for (const auto& p : s.line_segment().point()) {
848 road_boundary_ptr->right_boundary.line_points.push_back(p);
849 }
850 }
851 }
852 }
853 if (temp_road_boundary.hole_size() != 0) {
854 for (const auto& hole : temp_road_boundary.hole()) {
855 PolygonBoundary hole_boundary;
856 for (const auto& edge : hole.edge()) {
857 if (edge.type() == apollo::hdmap::BoundaryEdge::NORMAL) {
858 for (const auto& s : edge.curve().segment()) {
859 for (const auto& p : s.line_segment().point()) {
860 hole_boundary.polygon_points.push_back(p);
861 }
862 }
863 }
864 }
865 road_boundary_ptr->holes_boundary.push_back(hole_boundary);
866 }
867 }
868 }
869 road_boundaries->push_back(road_boundary_ptr);
870 }
871 }
872 return 0;
873}
874
875int HDMapImpl::GetRoi(const apollo::common::PointENU& point, double radius,
876 std::vector<RoadRoiPtr>* roads_roi,
877 std::vector<PolygonRoiPtr>* polygons_roi) {
878 if (roads_roi == nullptr || polygons_roi == nullptr) {
879 AERROR << "the pointer in parameter is null";
880 return -1;
881 }
882 roads_roi->clear();
883 polygons_roi->clear();
884 std::set<std::string> polygon_id_set;
885 std::vector<RoadInfoConstPtr> roads;
886 std::vector<LaneInfoConstPtr> lanes;
887 if (GetRoads(point, radius, &roads) != 0) {
888 AERROR << "can not get roads in the range.";
889 return -1;
890 }
891 if (GetLanes(point, radius, &lanes) != 0) {
892 AERROR << "can not get lanes in the range.";
893 return -1;
894 }
895 for (const auto& road_ptr : roads) {
896 // get junction polygon
897 if (road_ptr->has_junction_id()) {
898 JunctionInfoConstPtr junction_ptr =
899 GetJunctionById(road_ptr->junction_id());
900 if (polygon_id_set.find(junction_ptr->id().id()) ==
901 polygon_id_set.end()) {
902 PolygonRoiPtr polygon_roi_ptr(new PolygonRoi());
903 polygon_roi_ptr->polygon = junction_ptr->polygon();
904 polygon_roi_ptr->attribute.type = PolygonType::JUNCTION_POLYGON;
905 polygon_roi_ptr->attribute.id = junction_ptr->id();
906 polygons_roi->push_back(polygon_roi_ptr);
907 polygon_id_set.insert(junction_ptr->id().id());
908 }
909 } else {
910 // get road boundary
911 RoadRoiPtr road_boundary_ptr(new RoadRoi());
912 std::vector<apollo::hdmap::RoadBoundary> temp_roads_roi;
913 temp_roads_roi = road_ptr->GetBoundaries();
914 if (!temp_roads_roi.empty()) {
915 road_boundary_ptr->id = road_ptr->id();
916 for (const auto& temp_road_boundary : temp_roads_roi) {
917 apollo::hdmap::BoundaryPolygon boundary_polygon =
918 temp_road_boundary.outer_polygon();
919 for (const auto& edge : boundary_polygon.edge()) {
921 for (const auto& s : edge.curve().segment()) {
922 for (const auto& p : s.line_segment().point()) {
923 road_boundary_ptr->left_boundary.line_points.push_back(p);
924 }
925 }
926 }
928 for (const auto& s : edge.curve().segment()) {
929 for (const auto& p : s.line_segment().point()) {
930 road_boundary_ptr->right_boundary.line_points.push_back(p);
931 }
932 }
933 }
934 }
935 if (temp_road_boundary.hole_size() != 0) {
936 for (const auto& hole : temp_road_boundary.hole()) {
937 PolygonBoundary hole_boundary;
938 for (const auto& edge : hole.edge()) {
939 if (edge.type() == apollo::hdmap::BoundaryEdge::NORMAL) {
940 for (const auto& s : edge.curve().segment()) {
941 for (const auto& p : s.line_segment().point()) {
942 hole_boundary.polygon_points.push_back(p);
943 }
944 }
945 }
946 }
947 road_boundary_ptr->holes_boundary.push_back(hole_boundary);
948 }
949 }
950 }
951 roads_roi->push_back(road_boundary_ptr);
952 }
953 }
954 }
955
956 for (const auto& lane_ptr : lanes) {
957 // get parking space polygon
958 for (const auto& overlap_id : lane_ptr->lane().overlap_id()) {
959 OverlapInfoConstPtr overlap_ptr = GetOverlapById(overlap_id);
960 for (int i = 0; i < overlap_ptr->overlap().object_size(); ++i) {
961 if (overlap_ptr->overlap().object(i).id().id() == lane_ptr->id().id()) {
962 continue;
963 } else {
964 ParkingSpaceInfoConstPtr parkingspace_ptr =
965 GetParkingSpaceById(overlap_ptr->overlap().object(i).id());
966 if (parkingspace_ptr != nullptr) {
967 if (polygon_id_set.find(parkingspace_ptr->id().id()) ==
968 polygon_id_set.end()) {
969 PolygonRoiPtr polygon_roi_ptr(new PolygonRoi());
970 polygon_roi_ptr->polygon = parkingspace_ptr->polygon();
971 polygon_roi_ptr->attribute.type =
973 polygon_roi_ptr->attribute.id = parkingspace_ptr->id();
974 polygons_roi->push_back(polygon_roi_ptr);
975 polygon_id_set.insert(parkingspace_ptr->id().id());
976 }
977 }
978 }
979 }
980 }
981 }
982 return 0;
983}
984
986 const apollo::common::PointENU& point, const double distance,
987 std::vector<SignalInfoConstPtr>* signals) const {
988 CHECK_NOTNULL(signals);
989
990 signals->clear();
991 LaneInfoConstPtr lane_ptr = nullptr;
992 double nearest_s = 0.0;
993 double nearest_l = 0.0;
994
995 std::vector<LaneInfoConstPtr> temp_surrounding_lanes;
996 std::vector<LaneInfoConstPtr> surrounding_lanes;
997 int s_index = 0;
999 car_point.set_x(point.x());
1000 car_point.set_y(point.y());
1002 if (GetLanes(point, kLanesSearchRange, &temp_surrounding_lanes) == -1) {
1003 AINFO << "Can not find lanes around car.";
1004 return -1;
1005 }
1006 for (const auto& surround_lane : temp_surrounding_lanes) {
1007 if (surround_lane->IsOnLane(car_point)) {
1008 surrounding_lanes.push_back(surround_lane);
1009 }
1010 }
1011 if (surrounding_lanes.empty()) {
1012 AINFO << "Car is not on lane.";
1013 return -1;
1014 }
1015 for (const auto& lane : surrounding_lanes) {
1016 if (!lane->signals().empty()) {
1017 lane_ptr = lane;
1018 nearest_l =
1019 lane_ptr->DistanceTo(car_point, &map_point, &nearest_s, &s_index);
1020 break;
1021 }
1022 }
1023 if (lane_ptr == nullptr) {
1024 GetNearestLane(point, &lane_ptr, &nearest_s, &nearest_l);
1025 if (lane_ptr == nullptr) {
1026 return -1;
1027 }
1028 }
1029
1030 double unused_distance = distance + kBackwardDistance;
1031 double back_distance = kBackwardDistance;
1032 double s = nearest_s;
1033 while (s < back_distance) {
1034 for (const auto& predecessor_lane_id : lane_ptr->lane().predecessor_id()) {
1035 lane_ptr = GetLaneById(predecessor_lane_id);
1036 if (lane_ptr->lane().turn() == apollo::hdmap::Lane::NO_TURN) {
1037 break;
1038 }
1039 }
1040 back_distance = back_distance - s;
1041 s = lane_ptr->total_length();
1042 }
1043 double s_start = s - back_distance;
1044 while (lane_ptr != nullptr) {
1045 double signal_min_dist = std::numeric_limits<double>::infinity();
1046 std::vector<SignalInfoConstPtr> min_dist_signal_ptr;
1047 for (const auto& overlap_id : lane_ptr->lane().overlap_id()) {
1048 OverlapInfoConstPtr overlap_ptr = GetOverlapById(overlap_id);
1049 double lane_overlap_offset_s = 0.0;
1050 SignalInfoConstPtr signal_ptr = nullptr;
1051 for (int i = 0; i < overlap_ptr->overlap().object_size(); ++i) {
1052 if (overlap_ptr->overlap().object(i).id().id() == lane_ptr->id().id()) {
1053 lane_overlap_offset_s =
1054 overlap_ptr->overlap().object(i).lane_overlap_info().start_s() -
1055 s_start;
1056 continue;
1057 }
1058 signal_ptr = GetSignalById(overlap_ptr->overlap().object(i).id());
1059 if (signal_ptr == nullptr || lane_overlap_offset_s < 0.0) {
1060 break;
1061 }
1062 if (lane_overlap_offset_s < signal_min_dist) {
1063 signal_min_dist = lane_overlap_offset_s;
1064 min_dist_signal_ptr.clear();
1065 min_dist_signal_ptr.push_back(signal_ptr);
1066 } else if (lane_overlap_offset_s < (signal_min_dist + 0.1) &&
1067 lane_overlap_offset_s > (signal_min_dist - 0.1)) {
1068 min_dist_signal_ptr.push_back(signal_ptr);
1069 }
1070 }
1071 }
1072 if (!min_dist_signal_ptr.empty() && unused_distance >= signal_min_dist) {
1073 *signals = min_dist_signal_ptr;
1074 break;
1075 }
1076 unused_distance = unused_distance - (lane_ptr->total_length() - s_start);
1077 if (unused_distance <= 0) {
1078 break;
1079 }
1080 LaneInfoConstPtr tmp_lane_ptr = nullptr;
1081 for (const auto& successor_lane_id : lane_ptr->lane().successor_id()) {
1082 tmp_lane_ptr = GetLaneById(successor_lane_id);
1083 if (tmp_lane_ptr->lane().turn() == apollo::hdmap::Lane::NO_TURN) {
1084 break;
1085 }
1086 }
1087 lane_ptr = tmp_lane_ptr;
1088 s_start = 0;
1089 }
1090 return 0;
1091}
1092
1094 const Id& id, std::vector<StopSignInfoConstPtr>* stop_signs) const {
1095 CHECK_NOTNULL(stop_signs);
1096
1097 const auto& stop_sign = GetStopSignById(id);
1098 if (stop_sign == nullptr) {
1099 return -1;
1100 }
1101
1102 std::vector<Id> associate_stop_sign_ids;
1103 const auto junction_ids = stop_sign->OverlapJunctionIds();
1104 for (const auto& junction_id : junction_ids) {
1105 const auto& junction = GetJunctionById(junction_id);
1106 if (junction == nullptr) {
1107 continue;
1108 }
1109 const auto stop_sign_ids = junction->OverlapStopSignIds();
1110 std::copy(stop_sign_ids.begin(), stop_sign_ids.end(),
1111 std::back_inserter(associate_stop_sign_ids));
1112 }
1113
1114 std::vector<Id> associate_lane_ids;
1115 for (const auto& stop_sign_id : associate_stop_sign_ids) {
1116 if (stop_sign_id.id() == id.id()) {
1117 // exclude current stop sign
1118 continue;
1119 }
1120 const auto& stop_sign = GetStopSignById(stop_sign_id);
1121 if (stop_sign == nullptr) {
1122 continue;
1123 }
1124 stop_signs->push_back(stop_sign);
1125 }
1126
1127 return 0;
1128}
1129
1131 const apollo::common::PointENU& point, const double distance,
1132 std::vector<BarrierGateInfoConstPtr>* barrier_gates) const {
1133 CHECK_NOTNULL(barrier_gates);
1134
1135 barrier_gates->clear();
1136 LaneInfoConstPtr lane_ptr = nullptr;
1137 double nearest_s = 0.0;
1138 double nearest_l = 0.0;
1139
1140 std::vector<LaneInfoConstPtr> temp_surrounding_lanes;
1141 std::vector<LaneInfoConstPtr> surrounding_lanes;
1142 int s_index = 0;
1144 car_point.set_x(point.x());
1145 car_point.set_y(point.y());
1147 if (GetLanes(point, kLanesSearchRange, &temp_surrounding_lanes) == -1) {
1148 AINFO << "Can not find lanes around car.";
1149 return -1;
1150 }
1151 for (const auto& surround_lane : temp_surrounding_lanes) {
1152 if (surround_lane->IsOnLane(car_point)) {
1153 surrounding_lanes.push_back(surround_lane);
1154 }
1155 }
1156 if (surrounding_lanes.empty()) {
1157 AINFO << "Car is not on lane.";
1158 return -1;
1159 }
1160 for (const auto& lane : surrounding_lanes) {
1161 if (!lane->barrier_gates().empty()) {
1162 lane_ptr = lane;
1163 nearest_l =
1164 lane_ptr->DistanceTo(car_point, &map_point, &nearest_s, &s_index);
1165 break;
1166 }
1167 }
1168 if (lane_ptr == nullptr) {
1169 GetNearestLane(point, &lane_ptr, &nearest_s, &nearest_l);
1170 if (lane_ptr == nullptr) {
1171 return -1;
1172 }
1173 }
1174
1175 double unused_distance = distance + kBackwardDistance;
1176 double back_distance = kBackwardDistance;
1177 double s = nearest_s;
1178 while (s < back_distance) {
1179 for (const auto& predecessor_lane_id : lane_ptr->lane().predecessor_id()) {
1180 lane_ptr = GetLaneById(predecessor_lane_id);
1181 if (lane_ptr->lane().turn() == apollo::hdmap::Lane::NO_TURN) {
1182 break;
1183 }
1184 }
1185 back_distance = back_distance - s;
1186 s = lane_ptr->total_length();
1187 }
1188 double s_start = s - back_distance;
1189 while (lane_ptr != nullptr) {
1190 double barrier_min_dist = std::numeric_limits<double>::infinity();
1191 std::vector<BarrierGateInfoConstPtr> min_dist_barrier_ptr;
1192 for (const auto& overlap_id : lane_ptr->lane().overlap_id()) {
1193 OverlapInfoConstPtr overlap_ptr = GetOverlapById(overlap_id);
1194 double lane_overlap_offset_s = 0.0;
1195 BarrierGateInfoConstPtr barrier_ptr = nullptr;
1196 for (int i = 0; i < overlap_ptr->overlap().object_size(); ++i) {
1197 if (overlap_ptr->overlap().object(i).id().id() == lane_ptr->id().id()) {
1198 lane_overlap_offset_s =
1199 overlap_ptr->overlap().object(i).lane_overlap_info().start_s() -
1200 s_start;
1201 continue;
1202 }
1203 barrier_ptr = GetBarrierGateById(overlap_ptr->overlap().object(i).id());
1204 if (barrier_ptr == nullptr || lane_overlap_offset_s < 0.0) {
1205 break;
1206 }
1207 if (lane_overlap_offset_s < barrier_min_dist) {
1208 barrier_min_dist = lane_overlap_offset_s;
1209 min_dist_barrier_ptr.clear();
1210 min_dist_barrier_ptr.push_back(barrier_ptr);
1211 } else if (lane_overlap_offset_s < (barrier_min_dist + 0.1) &&
1212 lane_overlap_offset_s > (barrier_min_dist - 0.1)) {
1213 min_dist_barrier_ptr.push_back(barrier_ptr);
1214 }
1215 }
1216 }
1217 if (!min_dist_barrier_ptr.empty() && unused_distance >= barrier_min_dist) {
1218 *barrier_gates = min_dist_barrier_ptr;
1219 break;
1220 }
1221 unused_distance = unused_distance - (lane_ptr->total_length() - s_start);
1222 if (unused_distance <= 0) {
1223 break;
1224 }
1225 LaneInfoConstPtr tmp_lane_ptr = nullptr;
1226 for (const auto& successor_lane_id : lane_ptr->lane().successor_id()) {
1227 tmp_lane_ptr = GetLaneById(successor_lane_id);
1228 if (tmp_lane_ptr->lane().turn() == apollo::hdmap::Lane::NO_TURN) {
1229 break;
1230 }
1231 }
1232 lane_ptr = tmp_lane_ptr;
1233 s_start = 0;
1234 }
1235 return 0;
1236}
1237
1239 const Id& id, std::vector<LaneInfoConstPtr>* lanes) const {
1240 CHECK_NOTNULL(lanes);
1241
1242 const auto& stop_sign = GetStopSignById(id);
1243 if (stop_sign == nullptr) {
1244 return -1;
1245 }
1246
1247 std::vector<Id> associate_stop_sign_ids;
1248 const auto junction_ids = stop_sign->OverlapJunctionIds();
1249 for (const auto& junction_id : junction_ids) {
1250 const auto& junction = GetJunctionById(junction_id);
1251 if (junction == nullptr) {
1252 continue;
1253 }
1254 const auto stop_sign_ids = junction->OverlapStopSignIds();
1255 std::copy(stop_sign_ids.begin(), stop_sign_ids.end(),
1256 std::back_inserter(associate_stop_sign_ids));
1257 }
1258
1259 std::vector<Id> associate_lane_ids;
1260 for (const auto& stop_sign_id : associate_stop_sign_ids) {
1261 if (stop_sign_id.id() == id.id()) {
1262 // exclude current stop sign
1263 continue;
1264 }
1265 const auto& stop_sign = GetStopSignById(stop_sign_id);
1266 if (stop_sign == nullptr) {
1267 continue;
1268 }
1269 const auto lane_ids = stop_sign->OverlapLaneIds();
1270 std::copy(lane_ids.begin(), lane_ids.end(),
1271 std::back_inserter(associate_lane_ids));
1272 }
1273
1274 for (const auto lane_id : associate_lane_ids) {
1275 const auto& lane = GetLaneById(lane_id);
1276 if (lane == nullptr) {
1277 continue;
1278 }
1279 lanes->push_back(lane);
1280 }
1281
1282 return 0;
1283}
1284
1286 const std::pair<double, double>& range,
1287 Map* local_map) const {
1288 CHECK_NOTNULL(local_map);
1289
1290 double distance = std::max(range.first, range.second);
1291 CHECK_GT(distance, 0.0);
1292
1293 std::vector<LaneInfoConstPtr> lanes;
1294 GetLanes(point, distance, &lanes);
1295
1296 std::vector<JunctionInfoConstPtr> junctions;
1297 GetJunctions(point, distance, &junctions);
1298
1299 std::vector<CrosswalkInfoConstPtr> crosswalks;
1300 GetCrosswalks(point, distance, &crosswalks);
1301
1302 std::vector<SignalInfoConstPtr> signals;
1303 GetSignals(point, distance, &signals);
1304
1305 std::vector<StopSignInfoConstPtr> stop_signs;
1306 GetStopSigns(point, distance, &stop_signs);
1307
1308 std::vector<YieldSignInfoConstPtr> yield_signs;
1309 GetYieldSigns(point, distance, &yield_signs);
1310
1311 std::vector<ClearAreaInfoConstPtr> clear_areas;
1312 GetClearAreas(point, distance, &clear_areas);
1313
1314 std::vector<SpeedBumpInfoConstPtr> speed_bumps;
1315 GetSpeedBumps(point, distance, &speed_bumps);
1316
1317 std::vector<RoadInfoConstPtr> roads;
1318 GetRoads(point, distance, &roads);
1319
1320 std::vector<ParkingSpaceInfoConstPtr> parking_spaces;
1321 GetParkingSpaces(point, distance, &parking_spaces);
1322
1323 std::unordered_set<std::string> map_element_ids;
1324 std::vector<Id> overlap_ids;
1325
1326 for (auto& lane_ptr : lanes) {
1327 map_element_ids.insert(lane_ptr->id().id());
1328 std::copy(lane_ptr->lane().overlap_id().begin(),
1329 lane_ptr->lane().overlap_id().end(),
1330 std::back_inserter(overlap_ids));
1331 *local_map->add_lane() = lane_ptr->lane();
1332 }
1333
1334 for (auto& crosswalk_ptr : crosswalks) {
1335 map_element_ids.insert(crosswalk_ptr->id().id());
1336 std::copy(crosswalk_ptr->crosswalk().overlap_id().begin(),
1337 crosswalk_ptr->crosswalk().overlap_id().end(),
1338 std::back_inserter(overlap_ids));
1339 *local_map->add_crosswalk() = crosswalk_ptr->crosswalk();
1340 }
1341
1342 for (auto& junction_ptr : junctions) {
1343 map_element_ids.insert(junction_ptr->id().id());
1344 std::copy(junction_ptr->junction().overlap_id().begin(),
1345 junction_ptr->junction().overlap_id().end(),
1346 std::back_inserter(overlap_ids));
1347 *local_map->add_junction() = junction_ptr->junction();
1348 }
1349
1350 for (auto& signal_ptr : signals) {
1351 map_element_ids.insert(signal_ptr->id().id());
1352 std::copy(signal_ptr->signal().overlap_id().begin(),
1353 signal_ptr->signal().overlap_id().end(),
1354 std::back_inserter(overlap_ids));
1355 *local_map->add_signal() = signal_ptr->signal();
1356 }
1357
1358 for (auto& stop_sign_ptr : stop_signs) {
1359 map_element_ids.insert(stop_sign_ptr->id().id());
1360 std::copy(stop_sign_ptr->stop_sign().overlap_id().begin(),
1361 stop_sign_ptr->stop_sign().overlap_id().end(),
1362 std::back_inserter(overlap_ids));
1363 *local_map->add_stop_sign() = stop_sign_ptr->stop_sign();
1364 }
1365
1366 for (auto& yield_sign_ptr : yield_signs) {
1367 std::copy(yield_sign_ptr->yield_sign().overlap_id().begin(),
1368 yield_sign_ptr->yield_sign().overlap_id().end(),
1369 std::back_inserter(overlap_ids));
1370 map_element_ids.insert(yield_sign_ptr->id().id());
1371 *local_map->add_yield() = yield_sign_ptr->yield_sign();
1372 }
1373
1374 for (auto& clear_area_ptr : clear_areas) {
1375 map_element_ids.insert(clear_area_ptr->id().id());
1376 std::copy(clear_area_ptr->clear_area().overlap_id().begin(),
1377 clear_area_ptr->clear_area().overlap_id().end(),
1378 std::back_inserter(overlap_ids));
1379 *local_map->add_clear_area() = clear_area_ptr->clear_area();
1380 }
1381
1382 for (auto& speed_bump_ptr : speed_bumps) {
1383 map_element_ids.insert(speed_bump_ptr->id().id());
1384 std::copy(speed_bump_ptr->speed_bump().overlap_id().begin(),
1385 speed_bump_ptr->speed_bump().overlap_id().end(),
1386 std::back_inserter(overlap_ids));
1387 *local_map->add_speed_bump() = speed_bump_ptr->speed_bump();
1388 }
1389
1390 for (auto& road_ptr : roads) {
1391 map_element_ids.insert(road_ptr->id().id());
1392 *local_map->add_road() = road_ptr->road();
1393 }
1394
1395 for (auto& parking_space_ptr : parking_spaces) {
1396 map_element_ids.insert(parking_space_ptr->id().id());
1397 std::copy(parking_space_ptr->parking_space().overlap_id().begin(),
1398 parking_space_ptr->parking_space().overlap_id().end(),
1399 std::back_inserter(overlap_ids));
1400 *local_map->add_parking_space() = parking_space_ptr->parking_space();
1401 }
1402
1403 for (auto& overlap_id : overlap_ids) {
1404 auto overlap_ptr = GetOverlapById(overlap_id);
1405 if (overlap_ptr == nullptr) {
1406 AERROR << "overlpa id [" << overlap_id.id() << "] is not found.";
1407 continue;
1408 }
1409
1410 bool need_delete = false;
1411 for (auto& overlap_object : overlap_ptr->overlap().object()) {
1412 if (map_element_ids.count(overlap_object.id().id()) <= 0) {
1413 need_delete = true;
1414 }
1415 }
1416
1417 if (!need_delete) {
1418 *local_map->add_overlap() = overlap_ptr->overlap();
1419 }
1420 }
1421
1422 return 0;
1423}
1424
1426 double distance, double central_heading,
1427 double max_heading_difference,
1428 std::vector<RSUInfoConstPtr>* rsus) const {
1429 CHECK_NOTNULL(rsus);
1430
1431 rsus->clear();
1432 LaneInfoConstPtr lane_ptr = nullptr;
1433 apollo::common::math::Vec2d target_point(point.x(), point.y());
1434
1435 double nearest_s = 0.0;
1436 double nearest_l = 0.0;
1437 if (GetNearestLaneWithHeading(target_point, distance, central_heading,
1438 max_heading_difference, &lane_ptr, &nearest_s,
1439 &nearest_l) == -1) {
1440 AERROR << "Fail to get nearest lanes";
1441 return -1;
1442 }
1443
1444 if (lane_ptr == nullptr) {
1445 AERROR << "Fail to get nearest lanes";
1446 return -1;
1447 }
1448
1449 double s = 0;
1450 double real_distance = distance + nearest_s;
1451 const std::string nearst_lane_id = lane_ptr->id().id();
1452
1453 while (s < real_distance) {
1454 s += lane_ptr->total_length();
1455 std::vector<std::pair<double, JunctionInfoConstPtr>> overlap_junctions;
1456 double start_s = 0;
1457 for (size_t x = 0; x < lane_ptr->junctions().size(); ++x) {
1458 const auto overlap_ptr = lane_ptr->junctions()[x];
1459 for (int i = 0; i < overlap_ptr->overlap().object_size(); ++i) {
1460 const auto& overlap_object = overlap_ptr->overlap().object(i);
1461 if (overlap_object.id().id() == lane_ptr->id().id()) {
1462 start_s = overlap_object.lane_overlap_info().start_s();
1463 continue;
1464 }
1465
1466 const auto junction_ptr = GetJunctionById(overlap_object.id());
1467 CHECK_NOTNULL(junction_ptr);
1468 if (nearst_lane_id == lane_ptr->id().id() &&
1469 !junction_ptr->polygon().IsPointIn(target_point)) {
1470 if (nearest_s > start_s) {
1471 continue;
1472 }
1473 }
1474
1475 overlap_junctions.push_back(std::make_pair(start_s, junction_ptr));
1476 }
1477 }
1478
1479 std::sort(overlap_junctions.begin(), overlap_junctions.end());
1480
1481 std::set<std::string> duplicate_checker;
1482 for (const auto& overlap_junction : overlap_junctions) {
1483 const auto& junction = overlap_junction.second;
1484 if (duplicate_checker.count(junction->id().id()) > 0) {
1485 continue;
1486 }
1487 duplicate_checker.insert(junction->id().id());
1488
1489 for (const auto& overlap_id : junction->junction().overlap_id()) {
1490 OverlapInfoConstPtr overlap_ptr = GetOverlapById(overlap_id);
1491 CHECK_NOTNULL(overlap_ptr);
1492 for (int i = 0; i < overlap_ptr->overlap().object_size(); ++i) {
1493 const auto& overlap_object = overlap_ptr->overlap().object(i);
1494 if (!overlap_object.has_rsu_overlap_info()) {
1495 continue;
1496 }
1497
1498 const auto rsu_ptr = GetRSUById(overlap_object.id());
1499 if (rsu_ptr != nullptr) {
1500 rsus->push_back(rsu_ptr);
1501 }
1502 }
1503 }
1504
1505 if (!rsus->empty()) {
1506 break;
1507 }
1508 }
1509
1510 if (!rsus->empty()) {
1511 break;
1512 }
1513
1514 for (const auto suc_lane_id : lane_ptr->lane().successor_id()) {
1515 LaneInfoConstPtr suc_lane_ptr = GetLaneById(suc_lane_id);
1516 if (lane_ptr->lane().successor_id_size() > 1) {
1517 if (suc_lane_ptr->lane().turn() == apollo::hdmap::Lane::NO_TURN) {
1518 lane_ptr = suc_lane_ptr;
1519 break;
1520 }
1521 } else {
1522 lane_ptr = suc_lane_ptr;
1523 break;
1524 }
1525 }
1526 }
1527
1528 if (rsus->empty()) {
1529 return -1;
1530 }
1531
1532 return 0;
1533}
1534
1535template <class Table, class BoxTable, class KDTree>
1536void HDMapImpl::BuildSegmentKDTree(const Table& table,
1537 const AABoxKDTreeParams& params,
1538 BoxTable* const box_table,
1539 std::unique_ptr<KDTree>* const kdtree) {
1540 box_table->clear();
1541 for (const auto& info_with_id : table) {
1542 const auto* info = info_with_id.second.get();
1543 for (size_t id = 0; id < info->segments().size(); ++id) {
1544 const auto& segment = info->segments()[id];
1545 box_table->emplace_back(
1546 apollo::common::math::AABox2d(segment.start(), segment.end()), info,
1547 &segment, id);
1548 }
1549 }
1550 kdtree->reset(new KDTree(*box_table, params));
1551}
1552
1553template <class Table, class BoxTable, class KDTree>
1554void HDMapImpl::BuildPolygonKDTree(const Table& table,
1555 const AABoxKDTreeParams& params,
1556 BoxTable* const box_table,
1557 std::unique_ptr<KDTree>* const kdtree) {
1558 box_table->clear();
1559 for (const auto& info_with_id : table) {
1560 const auto* info = info_with_id.second.get();
1561 const auto& polygon = info->polygon();
1562 box_table->emplace_back(polygon.AABoundingBox(), info, &polygon, 0);
1563 }
1564 kdtree->reset(new KDTree(*box_table, params));
1565}
1566
1567void HDMapImpl::BuildLaneSegmentKDTree() {
1568 AABoxKDTreeParams params;
1569 params.max_leaf_dimension = 5.0; // meters.
1570 params.max_leaf_size = 16;
1571 BuildSegmentKDTree(lane_table_, params, &lane_segment_boxes_,
1572 &lane_segment_kdtree_);
1573}
1574
1575void HDMapImpl::BuildJunctionPolygonKDTree() {
1576 AABoxKDTreeParams params;
1577 params.max_leaf_dimension = 5.0; // meters.
1578 params.max_leaf_size = 1;
1579 BuildPolygonKDTree(junction_table_, params, &junction_polygon_boxes_,
1580 &junction_polygon_kdtree_);
1581}
1582
1583void HDMapImpl::BuildAreaPolygonKDTree() {
1584 AABoxKDTreeParams params;
1585 params.max_leaf_dimension = 5.0; // meters.
1586 params.max_leaf_size = 1;
1587 BuildPolygonKDTree(area_table_, params, &area_polygon_boxes_,
1588 &area_polygon_kdtree_);
1589}
1590
1591void HDMapImpl::BuildCrosswalkPolygonKDTree() {
1592 AABoxKDTreeParams params;
1593 params.max_leaf_dimension = 5.0; // meters.
1594 params.max_leaf_size = 1;
1595 BuildPolygonKDTree(crosswalk_table_, params, &crosswalk_polygon_boxes_,
1596 &crosswalk_polygon_kdtree_);
1597}
1598
1599void HDMapImpl::BuildSignalSegmentKDTree() {
1600 AABoxKDTreeParams params;
1601 params.max_leaf_dimension = 5.0; // meters.
1602 params.max_leaf_size = 4;
1603 BuildSegmentKDTree(signal_table_, params, &signal_segment_boxes_,
1604 &signal_segment_kdtree_);
1605}
1606
1607void HDMapImpl::BuildBarrierGateSegmentKDTree() {
1608 AABoxKDTreeParams params;
1609 params.max_leaf_dimension = 5.0; // meters.
1610 params.max_leaf_size = 4;
1611 BuildSegmentKDTree(barrier_gate_table_, params, &barrier_gate_segment_boxes_,
1612 &barrier_gate_segment_kdtree_);
1613}
1614
1615void HDMapImpl::BuildStopSignSegmentKDTree() {
1616 AABoxKDTreeParams params;
1617 params.max_leaf_dimension = 5.0; // meters.
1618 params.max_leaf_size = 4;
1619 BuildSegmentKDTree(stop_sign_table_, params, &stop_sign_segment_boxes_,
1620 &stop_sign_segment_kdtree_);
1621}
1622
1623void HDMapImpl::BuildYieldSignSegmentKDTree() {
1624 AABoxKDTreeParams params;
1625 params.max_leaf_dimension = 5.0; // meters.
1626 params.max_leaf_size = 4;
1627 BuildSegmentKDTree(yield_sign_table_, params, &yield_sign_segment_boxes_,
1628 &yield_sign_segment_kdtree_);
1629}
1630
1631void HDMapImpl::BuildClearAreaPolygonKDTree() {
1632 AABoxKDTreeParams params;
1633 params.max_leaf_dimension = 5.0; // meters.
1634 params.max_leaf_size = 4;
1635 BuildPolygonKDTree(clear_area_table_, params, &clear_area_polygon_boxes_,
1636 &clear_area_polygon_kdtree_);
1637}
1638
1639void HDMapImpl::BuildSpeedBumpSegmentKDTree() {
1640 AABoxKDTreeParams params;
1641 params.max_leaf_dimension = 5.0; // meters.
1642 params.max_leaf_size = 4;
1643 BuildSegmentKDTree(speed_bump_table_, params, &speed_bump_segment_boxes_,
1644 &speed_bump_segment_kdtree_);
1645}
1646
1647void HDMapImpl::BuildParkingSpacePolygonKDTree() {
1648 AABoxKDTreeParams params;
1649 params.max_leaf_dimension = 5.0; // meters.
1650 params.max_leaf_size = 4;
1651 BuildPolygonKDTree(parking_space_table_, params,
1652 &parking_space_polygon_boxes_,
1653 &parking_space_polygon_kdtree_);
1654}
1655
1656void HDMapImpl::BuildPNCJunctionPolygonKDTree() {
1657 AABoxKDTreeParams params;
1658 params.max_leaf_dimension = 5.0; // meters.
1659 params.max_leaf_size = 1;
1660 BuildPolygonKDTree(pnc_junction_table_, params, &pnc_junction_polygon_boxes_,
1661 &pnc_junction_polygon_kdtree_);
1662}
1663
1664template <class KDTree>
1665int HDMapImpl::SearchObjects(const Vec2d& center, const double radius,
1666 const KDTree& kdtree,
1667 std::vector<std::string>* const results) {
1668 static std::mutex mutex_search_object;
1669 UNIQUE_LOCK_MULTITHREAD(mutex_search_object);
1670 if (results == nullptr) {
1671 return -1;
1672 }
1673 auto objects = kdtree.GetObjects(center, radius);
1674 std::unordered_set<std::string> result_ids;
1675 result_ids.reserve(objects.size());
1676 for (const auto* object_ptr : objects) {
1677 result_ids.insert(object_ptr->object()->id().id());
1678 }
1679
1680 results->reserve(result_ids.size());
1681 results->assign(result_ids.begin(), result_ids.end());
1682 return 0;
1683}
1684
1685void HDMapImpl::Clear() {
1686 map_.Clear();
1687 lane_table_.clear();
1688 junction_table_.clear();
1689 area_table_.clear();
1690 signal_table_.clear();
1691 barrier_gate_table_.clear();
1692 crosswalk_table_.clear();
1693 stop_sign_table_.clear();
1694 yield_sign_table_.clear();
1695 overlap_table_.clear();
1696 rsu_table_.clear();
1697 lane_segment_boxes_.clear();
1698 lane_segment_kdtree_.reset(nullptr);
1699 junction_polygon_boxes_.clear();
1700 junction_polygon_kdtree_.reset(nullptr);
1701 area_polygon_boxes_.clear();
1702 area_polygon_kdtree_.reset(nullptr);
1703 crosswalk_polygon_boxes_.clear();
1704 crosswalk_polygon_kdtree_.reset(nullptr);
1705 signal_segment_boxes_.clear();
1706 signal_segment_kdtree_.reset(nullptr);
1707 barrier_gate_segment_boxes_.clear();
1708 barrier_gate_segment_kdtree_.reset(nullptr);
1709 stop_sign_segment_boxes_.clear();
1710 stop_sign_segment_kdtree_.reset(nullptr);
1711 yield_sign_segment_boxes_.clear();
1712 yield_sign_segment_kdtree_.reset(nullptr);
1713 clear_area_polygon_boxes_.clear();
1714 clear_area_polygon_kdtree_.reset(nullptr);
1715 speed_bump_segment_boxes_.clear();
1716 speed_bump_segment_kdtree_.reset(nullptr);
1717 parking_space_polygon_boxes_.clear();
1718 parking_space_polygon_kdtree_.reset(nullptr);
1719 pnc_junction_polygon_boxes_.clear();
1720 pnc_junction_polygon_kdtree_.reset(nullptr);
1721}
1722
1723} // namespace hdmap
1724} // namespace apollo
Implements a class of (undirected) axes-aligned bounding boxes in 2-D.
Definition aabox2d.h:42
Implements a class of 2-dimensional vectors.
Definition vec2d.h:42
void set_x(const double x)
Setter for x component
Definition vec2d.h:60
double DistanceTo(const Vec2d &other) const
Returns the distance to the given vector
Definition vec2d.cc:47
void set_y(const double y)
Setter for y component
Definition vec2d.h:63
int GetNearestLaneWithHeading(const apollo::common::PointENU &point, const double distance, const double central_heading, const double max_heading_difference, LaneInfoConstPtr *nearest_lane, double *nearest_s, double *nearest_l) const
get the nearest lane within a certain range by pose
int GetAreas(const apollo::common::PointENU &point, double distance, std::vector< AreaInfoConstPtr > *areas) const
get all areas in certain range
Id CreateHDMapId(const std::string &string_id) const
convert id data type
Definition hdmap_impl.cc:46
int GetRoadBoundaries(const apollo::common::PointENU &point, double radius, std::vector< RoadROIBoundaryPtr > *road_boundaries, std::vector< JunctionBoundaryPtr > *junctions) const
get all road and junctions boundaries within certain range
int GetStopSignAssociatedStopSigns(const Id &id, std::vector< StopSignInfoConstPtr > *stop_signs) const
get all other stop signs associated with a stop sign in the same junction
int GetJunctions(const apollo::common::PointENU &point, double distance, std::vector< JunctionInfoConstPtr > *junctions) const
get all junctions in certain range
int GetBarrierGates(const apollo::common::PointENU &point, double distance, std::vector< BarrierGateInfoConstPtr > *barrier_gates) const
get all barrier_gates in certain range
int GetNearestLane(const apollo::common::PointENU &point, LaneInfoConstPtr *nearest_lane, double *nearest_s, double *nearest_l) const
get nearest lane from target point,
OverlapInfoConstPtr GetOverlapById(const Id &id) const
int GetStopSigns(const apollo::common::PointENU &point, double distance, std::vector< StopSignInfoConstPtr > *stop_signs) const
get all stop signs in certain range
StopSignInfoConstPtr GetStopSignById(const Id &id) const
AreaInfoConstPtr GetAreaById(const Id &id) const
int GetLanesWithHeading(const apollo::common::PointENU &point, const double distance, const double central_heading, const double max_heading_difference, std::vector< LaneInfoConstPtr > *lanes) const
get all lanes within a certain range by pose
int LoadMapFromProto(const Map &map_proto)
load map from a protobuf message
Definition hdmap_impl.cc:75
JunctionInfoConstPtr GetJunctionById(const Id &id) const
ParkingSpaceInfoConstPtr GetParkingSpaceById(const Id &id) const
int GetNearestLaneWithDistance(const apollo::common::PointENU &point, const double distance, LaneInfoConstPtr *nearest_lane, double *nearest_s, double *nearest_l) const
get nearest lane from target point with search radius,
CrosswalkInfoConstPtr GetCrosswalkById(const Id &id) const
ClearAreaInfoConstPtr GetClearAreaById(const Id &id) const
int GetRoads(const apollo::common::PointENU &point, double distance, std::vector< RoadInfoConstPtr > *roads) const
get all roads in certain range
SignalInfoConstPtr GetSignalById(const Id &id) const
int GetPNCJunctions(const apollo::common::PointENU &point, double distance, std::vector< PNCJunctionInfoConstPtr > *pnc_junctions) const
get all pnc junctions in certain range
int GetForwardNearestRSUs(const apollo::common::PointENU &point, double distance, double central_heading, double max_heading_difference, std::vector< RSUInfoConstPtr > *rsus) const
get forward nearest rsus within certain range
int GetSignals(const apollo::common::PointENU &point, double distance, std::vector< SignalInfoConstPtr > *signals) const
get all signals in certain range
YieldSignInfoConstPtr GetYieldSignById(const Id &id) const
int GetCrosswalks(const apollo::common::PointENU &point, double distance, std::vector< CrosswalkInfoConstPtr > *crosswalks) const
get all crosswalks in certain range
int GetLocalMap(const apollo::common::PointENU &point, const std::pair< double, double > &range, Map *local_map) const
get a local map which is identical to the origin map except that all map elements without overlap wit...
int GetClearAreas(const apollo::common::PointENU &point, double distance, std::vector< ClearAreaInfoConstPtr > *clear_areas) const
get all clear areas in certain range
int GetRoi(const apollo::common::PointENU &point, double radius, std::vector< RoadRoiPtr > *roads_roi, std::vector< PolygonRoiPtr > *polygons_roi)
get ROI within certain range
PNCJunctionInfoConstPtr GetPNCJunctionById(const Id &id) const
int GetForwardNearestBarriersOnLane(const apollo::common::PointENU &point, const double distance, std::vector< BarrierGateInfoConstPtr > *barrier_gates) const
get forward nearest barrier_gates within certain range on the lane
RoadInfoConstPtr GetRoadById(const Id &id) const
int GetYieldSigns(const apollo::common::PointENU &point, double distance, std::vector< YieldSignInfoConstPtr > *yield_signs) const
get all yield signs in certain range
LaneInfoConstPtr GetLaneById(const Id &id) const
BarrierGateInfoConstPtr GetBarrierGateById(const Id &id) const
bool GetMapHeader(Header *map_header) const
Definition hdmap_impl.cc:67
RSUInfoConstPtr GetRSUById(const Id &id) const
int GetParkingSpaces(const apollo::common::PointENU &point, double distance, std::vector< ParkingSpaceInfoConstPtr > *parking_spaces) const
get all parking space in certain range
int GetSpeedBumps(const apollo::common::PointENU &point, double distance, std::vector< SpeedBumpInfoConstPtr > *speed_bumps) const
get all speed bumps in certain range
int LoadMapFromFile(const std::string &map_filename)
load map from local file
Definition hdmap_impl.cc:52
int GetForwardNearestSignalsOnLane(const apollo::common::PointENU &point, const double distance, std::vector< SignalInfoConstPtr > *signals) const
get forward nearest signals within certain range on the lane if there are two signals related to one ...
SpeedBumpInfoConstPtr GetSpeedBumpById(const Id &id) const
int GetStopSignAssociatedLanes(const Id &id, std::vector< LaneInfoConstPtr > *lanes) const
get all lanes associated with a stop sign in the same junction
int GetLanes(const apollo::common::PointENU &point, double distance, std::vector< LaneInfoConstPtr > *lanes) const
get all lanes in certain range
static bool LoadData(const std::string &filename, apollo::hdmap::Map *pb_map)
#define ACHECK(cond)
Definition log.h:80
#define AERROR
Definition log.h:44
#define AFATAL
Definition log.h:45
#define AINFO
Definition log.h:42
Some util functions.
#define UNIQUE_LOCK_MULTITHREAD(mutex_type)
Definition util.h:162
double NormalizeAngle(const double angle)
Normalize angle to [-PI, PI).
Definition math_utils.cc:53
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
Definition file.cc:132
std::shared_ptr< const PNCJunctionInfo > PNCJunctionInfoConstPtr
std::shared_ptr< const JunctionInfo > JunctionInfoConstPtr
std::shared_ptr< RoadROIBoundary > RoadROIBoundaryPtr
std::shared_ptr< const StopSignInfo > StopSignInfoConstPtr
std::shared_ptr< const AreaInfo > AreaInfoConstPtr
std::shared_ptr< const LaneInfo > LaneInfoConstPtr
std::shared_ptr< const ClearAreaInfo > ClearAreaInfoConstPtr
std::shared_ptr< const BarrierGateInfo > BarrierGateInfoConstPtr
std::shared_ptr< const SignalInfo > SignalInfoConstPtr
std::shared_ptr< const SpeedBumpInfo > SpeedBumpInfoConstPtr
std::shared_ptr< const RoadInfo > RoadInfoConstPtr
std::shared_ptr< const CrosswalkInfo > CrosswalkInfoConstPtr
std::shared_ptr< const RSUInfo > RSUInfoConstPtr
std::shared_ptr< JunctionBoundary > JunctionBoundaryPtr
std::shared_ptr< const YieldSignInfo > YieldSignInfoConstPtr
std::shared_ptr< const ParkingSpaceInfo > ParkingSpaceInfoConstPtr
std::shared_ptr< PolygonRoi > PolygonRoiPtr
std::shared_ptr< RoadRoi > RoadRoiPtr
std::shared_ptr< const OverlapInfo > OverlapInfoConstPtr
class register implement
Definition arena_queue.h:37
Contains parameters of axis-aligned bounding box.
repeated BoundaryEdge edge
optional string id
Definition map_id.proto:7
repeated Signal signal
Definition map.proto:51
repeated Area ad_area
Definition map.proto:60
repeated RSU rsu
Definition map.proto:59
repeated Junction junction
Definition map.proto:48
repeated StopSign stop_sign
Definition map.proto:50
repeated Crosswalk crosswalk
Definition map.proto:47
repeated ParkingSpace parking_space
Definition map.proto:57
repeated SpeedBump speed_bump
Definition map.proto:55
repeated Overlap overlap
Definition map.proto:53
optional Header header
Definition map.proto:45
repeated YieldSign yield
Definition map.proto:52
repeated BarrierGate barrier_gate
Definition map.proto:61
repeated Lane lane
Definition map.proto:49
repeated PNCJunction pnc_junction
Definition map.proto:58
repeated ClearArea clear_area
Definition map.proto:54
repeated Road road
Definition map.proto:56
std::vector< apollo::common::PointENU > polygon_points