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