20 #include <unordered_map> 30 #include "modules/map/proto/map.pb.h" 31 #include "modules/map/proto/map_clear_area.pb.h" 32 #include "modules/map/proto/map_crosswalk.pb.h" 33 #include "modules/map/proto/map_geometry.pb.h" 34 #include "modules/map/proto/map_junction.pb.h" 35 #include "modules/map/proto/map_lane.pb.h" 36 #include "modules/map/proto/map_overlap.pb.h" 37 #include "modules/map/proto/map_parking_space.pb.h" 38 #include "modules/map/proto/map_pnc_junction.pb.h" 39 #include "modules/map/proto/map_signal.pb.h" 40 #include "modules/map/proto/map_speed_bump.pb.h" 41 #include "modules/map/proto/map_stop_sign.pb.h" 42 #include "modules/map/proto/map_yield_sign.pb.h" 58 using LaneTable = std::unordered_map<std::string, std::shared_ptr<LaneInfo>>;
60 std::unordered_map<std::string, std::shared_ptr<JunctionInfo>>;
62 std::unordered_map<std::string, std::shared_ptr<SignalInfo>>;
64 std::unordered_map<std::string, std::shared_ptr<CrosswalkInfo>>;
66 std::unordered_map<std::string, std::shared_ptr<StopSignInfo>>;
68 std::unordered_map<std::string, std::shared_ptr<YieldSignInfo>>;
70 std::unordered_map<std::string, std::shared_ptr<ClearAreaInfo>>;
72 std::unordered_map<std::string, std::shared_ptr<SpeedBumpInfo>>;
74 std::unordered_map<std::string, std::shared_ptr<OverlapInfo>>;
75 using RoadTable = std::unordered_map<std::string, std::shared_ptr<RoadInfo>>;
77 std::unordered_map<std::string, std::shared_ptr<ParkingSpaceInfo>>;
79 std::unordered_map<std::string, std::shared_ptr<PNCJunctionInfo>>;
81 std::unordered_map<std::string, std::shared_ptr<RSUInfo>>;
119 int GetLanes(
const apollo::common::PointENU& point,
double distance,
120 std::vector<LaneInfoConstPtr>* lanes)
const;
128 int GetJunctions(
const apollo::common::PointENU& point,
double distance,
129 std::vector<JunctionInfoConstPtr>* junctions)
const;
137 int GetCrosswalks(
const apollo::common::PointENU& point,
double distance,
138 std::vector<CrosswalkInfoConstPtr>* crosswalks)
const;
146 int GetSignals(
const apollo::common::PointENU& point,
double distance,
147 std::vector<SignalInfoConstPtr>* signals)
const;
155 int GetStopSigns(
const apollo::common::PointENU& point,
double distance,
156 std::vector<StopSignInfoConstPtr>* stop_signs)
const;
164 int GetYieldSigns(
const apollo::common::PointENU& point,
double distance,
165 std::vector<YieldSignInfoConstPtr>* yield_signs)
const;
173 int GetClearAreas(
const apollo::common::PointENU& point,
double distance,
174 std::vector<ClearAreaInfoConstPtr>* clear_areas)
const;
182 int GetSpeedBumps(
const apollo::common::PointENU& point,
double distance,
183 std::vector<SpeedBumpInfoConstPtr>* speed_bumps)
const;
191 int GetRoads(
const apollo::common::PointENU& point,
double distance,
192 std::vector<RoadInfoConstPtr>* roads)
const;
202 const apollo::common::PointENU& point,
double distance,
203 std::vector<ParkingSpaceInfoConstPtr>* parking_spaces)
const;
213 const apollo::common::PointENU& point,
double distance,
214 std::vector<PNCJunctionInfoConstPtr>* pnc_junctions)
const;
226 double* nearest_l)
const;
239 const double distance,
240 const double central_heading,
241 const double max_heading_difference,
243 double* nearest_s,
double* nearest_l)
const;
254 const double distance,
const double central_heading,
255 const double max_heading_difference,
256 std::vector<LaneInfoConstPtr>* lanes)
const;
266 std::vector<RoadROIBoundaryPtr>* road_boundaries,
267 std::vector<JunctionBoundaryPtr>* junctions)
const;
277 std::vector<RoadRoiPtr>* road_boundaries,
278 std::vector<JunctionInfoConstPtr>* junctions)
const;
287 int GetRoi(
const apollo::common::PointENU& point,
double radius,
288 std::vector<RoadRoiPtr>* roads_roi,
289 std::vector<PolygonRoiPtr>* polygons_roi);
300 const apollo::common::PointENU& point,
const double distance,
301 std::vector<SignalInfoConstPtr>* signals)
const;
311 const Id&
id, std::vector<StopSignInfoConstPtr>* stop_signs)
const;
320 std::vector<LaneInfoConstPtr>* lanes)
const;
330 int GetLocalMap(
const apollo::common::PointENU& point,
331 const std::pair<double, double>& range, Map* local_map)
const;
343 double distance,
double central_heading,
344 double max_heading_difference,
345 std::vector<RSUInfoConstPtr>* rsus)
const;
349 std::vector<LaneInfoConstPtr>* lanes)
const;
351 std::vector<JunctionInfoConstPtr>* junctions)
const;
353 std::vector<CrosswalkInfoConstPtr>* crosswalks)
const;
355 std::vector<SignalInfoConstPtr>* signals)
const;
357 std::vector<StopSignInfoConstPtr>* stop_signs)
const;
359 std::vector<YieldSignInfoConstPtr>* yield_signs)
const;
361 std::vector<ClearAreaInfoConstPtr>* clear_areas)
const;
363 std::vector<SpeedBumpInfoConstPtr>* speed_bumps)
const;
366 std::vector<ParkingSpaceInfoConstPtr>* parking_spaces)
const;
369 std::vector<PNCJunctionInfoConstPtr>* pnc_junctions)
const;
372 double* nearest_l)
const;
374 const double distance,
375 const double central_heading,
376 const double max_heading_difference,
378 double* nearest_s,
double* nearest_l)
const;
380 const double distance,
const double central_heading,
381 const double max_heading_difference,
382 std::vector<LaneInfoConstPtr>* lanes)
const;
384 std::vector<RoadInfoConstPtr>* roads)
const;
386 template <
class Table,
class BoxTable,
class KDTree>
387 static void BuildSegmentKDTree(
389 BoxTable*
const box_table, std::unique_ptr<KDTree>*
const kdtree);
391 template <
class Table,
class BoxTable,
class KDTree>
392 static void BuildPolygonKDTree(
394 BoxTable*
const box_table, std::unique_ptr<KDTree>*
const kdtree);
396 void BuildLaneSegmentKDTree();
397 void BuildJunctionPolygonKDTree();
398 void BuildCrosswalkPolygonKDTree();
399 void BuildSignalSegmentKDTree();
400 void BuildStopSignSegmentKDTree();
401 void BuildYieldSignSegmentKDTree();
402 void BuildClearAreaPolygonKDTree();
403 void BuildSpeedBumpSegmentKDTree();
404 void BuildParkingSpacePolygonKDTree();
405 void BuildPNCJunctionPolygonKDTree();
407 template <
class KDTree>
409 const double radius,
const KDTree& kdtree,
410 std::vector<std::string>*
const results);
430 std::vector<LaneSegmentBox> lane_segment_boxes_;
431 std::unique_ptr<LaneSegmentKDTree> lane_segment_kdtree_;
433 std::vector<JunctionPolygonBox> junction_polygon_boxes_;
434 std::unique_ptr<JunctionPolygonKDTree> junction_polygon_kdtree_;
436 std::vector<CrosswalkPolygonBox> crosswalk_polygon_boxes_;
437 std::unique_ptr<CrosswalkPolygonKDTree> crosswalk_polygon_kdtree_;
439 std::vector<SignalSegmentBox> signal_segment_boxes_;
440 std::unique_ptr<SignalSegmentKDTree> signal_segment_kdtree_;
442 std::vector<StopSignSegmentBox> stop_sign_segment_boxes_;
443 std::unique_ptr<StopSignSegmentKDTree> stop_sign_segment_kdtree_;
445 std::vector<YieldSignSegmentBox> yield_sign_segment_boxes_;
446 std::unique_ptr<YieldSignSegmentKDTree> yield_sign_segment_kdtree_;
448 std::vector<ClearAreaPolygonBox> clear_area_polygon_boxes_;
449 std::unique_ptr<ClearAreaPolygonKDTree> clear_area_polygon_kdtree_;
451 std::vector<SpeedBumpSegmentBox> speed_bump_segment_boxes_;
452 std::unique_ptr<SpeedBumpSegmentKDTree> speed_bump_segment_kdtree_;
454 std::vector<ParkingSpacePolygonBox> parking_space_polygon_boxes_;
455 std::unique_ptr<ParkingSpacePolygonKDTree> parking_space_polygon_kdtree_;
457 std::vector<PNCJunctionPolygonBox> pnc_junction_polygon_boxes_;
458 std::unique_ptr<PNCJunctionPolygonKDTree> pnc_junction_polygon_kdtree_;
std::unordered_map< std::string, std::shared_ptr< SpeedBumpInfo > > SpeedBumpTable
Definition: hdmap_impl.h:72
std::unordered_map< std::string, std::shared_ptr< RoadInfo > > RoadTable
Definition: hdmap_impl.h:75
std::shared_ptr< const PNCJunctionInfo > PNCJunctionInfoConstPtr
Definition: hdmap_common.h:138
SpeedBumpInfoConstPtr GetSpeedBumpById(const Id &id) const
std::shared_ptr< const RoadInfo > RoadInfoConstPtr
Definition: hdmap_common.h:133
std::unordered_map< std::string, std::shared_ptr< LaneInfo > > LaneTable
Definition: hdmap_impl.h:58
int GetJunctions(const apollo::common::PointENU &point, double distance, std::vector< JunctionInfoConstPtr > *junctions) const
get all junctions in certain range
Define the LineSegment2d class.
std::shared_ptr< const ParkingSpaceInfo > ParkingSpaceInfoConstPtr
Definition: hdmap_common.h:134
CrosswalkInfoConstPtr GetCrosswalkById(const Id &id) const
int LoadMapFromFile(const std::string &map_filename)
load map from local file
int GetSpeedBumps(const apollo::common::PointENU &point, double distance, std::vector< SpeedBumpInfoConstPtr > *speed_bumps) const
get all speed bumps in certain range
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 ...
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
int GetSignals(const apollo::common::PointENU &point, double distance, std::vector< SignalInfoConstPtr > *signals) const
get all signals in certain range
RoadInfoConstPtr GetRoadById(const Id &id) const
int GetRoads(const apollo::common::PointENU &point, double distance, std::vector< RoadInfoConstPtr > *roads) const
get all roads in certain range
int GetPNCJunctions(const apollo::common::PointENU &point, double distance, std::vector< PNCJunctionInfoConstPtr > *pnc_junctions) const
get all pnc junctions in certain range
std::unordered_map< std::string, std::shared_ptr< ClearAreaInfo > > ClearAreaTable
Definition: hdmap_impl.h:70
int GetStopSigns(const apollo::common::PointENU &point, double distance, std::vector< StopSignInfoConstPtr > *stop_signs) const
get all stop signs in certain range
int GetCrosswalks(const apollo::common::PointENU &point, double distance, std::vector< CrosswalkInfoConstPtr > *crosswalks) const
get all crosswalks in certain range
OverlapInfoConstPtr GetOverlapById(const Id &id) const
RSUInfoConstPtr GetRSUById(const Id &id) const
LaneInfoConstPtr GetLaneById(const Id &id) const
StopSignInfoConstPtr GetStopSignById(const Id &id) const
std::unordered_map< std::string, std::shared_ptr< SignalInfo > > SignalTable
Definition: hdmap_impl.h:62
PNCJunctionInfoConstPtr GetPNCJunctionById(const Id &id) const
int GetRoi(const apollo::common::PointENU &point, double radius, std::vector< RoadRoiPtr > *roads_roi, std::vector< PolygonRoiPtr > *polygons_roi)
get ROI within 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...
Defines the templated AABoxKDTree2dNode class.
std::unordered_map< std::string, std::shared_ptr< RSUInfo > > RSUTable
Definition: hdmap_impl.h:81
std::unordered_map< std::string, std::shared_ptr< OverlapInfo > > OverlapTable
Definition: hdmap_impl.h:74
Defines the AABox2d class.
std::shared_ptr< const CrosswalkInfo > CrosswalkInfoConstPtr
Definition: hdmap_common.h:128
int GetNearestLane(const apollo::common::PointENU &point, LaneInfoConstPtr *nearest_lane, double *nearest_s, double *nearest_l) const
get nearest lane from target point,
Implements a class of 2-dimensional vectors.
Definition: vec2d.h:42
std::shared_ptr< const YieldSignInfo > YieldSignInfoConstPtr
Definition: hdmap_common.h:130
int GetYieldSigns(const apollo::common::PointENU &point, double distance, std::vector< YieldSignInfoConstPtr > *yield_signs) const
get all yield signs in certain range
std::unordered_map< std::string, std::shared_ptr< PNCJunctionInfo > > PNCJunctionTable
Definition: hdmap_impl.h:79
ClearAreaInfoConstPtr GetClearAreaById(const Id &id) const
YieldSignInfoConstPtr GetYieldSignById(const Id &id) const
std::shared_ptr< const SpeedBumpInfo > SpeedBumpInfoConstPtr
Definition: hdmap_common.h:132
std::unordered_map< std::string, std::shared_ptr< StopSignInfo > > StopSignTable
Definition: hdmap_impl.h:66
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
std::shared_ptr< const LaneInfo > LaneInfoConstPtr
Definition: hdmap_common.h:125
std::shared_ptr< const SignalInfo > SignalInfoConstPtr
Definition: hdmap_common.h:127
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
JunctionInfoConstPtr GetJunctionById(const Id &id) const
std::unordered_map< std::string, std::shared_ptr< ParkingSpaceInfo > > ParkingSpaceTable
Definition: hdmap_impl.h:77
High-precision map loader implement.
Definition: hdmap_impl.h:56
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 GetParkingSpaces(const apollo::common::PointENU &point, double distance, std::vector< ParkingSpaceInfoConstPtr > *parking_spaces) const
get all parking space in certain range
SignalInfoConstPtr GetSignalById(const Id &id) const
std::shared_ptr< const RSUInfo > RSUInfoConstPtr
Definition: hdmap_common.h:139
int GetClearAreas(const apollo::common::PointENU &point, double distance, std::vector< ClearAreaInfoConstPtr > *clear_areas) const
get all clear areas in certain range
int GetLanes(const apollo::common::PointENU &point, double distance, std::vector< LaneInfoConstPtr > *lanes) const
get all lanes in certain range
int GetStopSignAssociatedLanes(const Id &id, std::vector< LaneInfoConstPtr > *lanes) const
get all lanes associated with a stop sign in the same junction
std::shared_ptr< const ClearAreaInfo > ClearAreaInfoConstPtr
Definition: hdmap_common.h:131
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
std::shared_ptr< const StopSignInfo > StopSignInfoConstPtr
Definition: hdmap_common.h:129
ParkingSpaceInfoConstPtr GetParkingSpaceById(const Id &id) const
std::unordered_map< std::string, std::shared_ptr< CrosswalkInfo > > CrosswalkTable
Definition: hdmap_impl.h:64
std::shared_ptr< const OverlapInfo > OverlapInfoConstPtr
Definition: hdmap_common.h:124
Define the Polygon2d class.
std::shared_ptr< const JunctionInfo > JunctionInfoConstPtr
Definition: hdmap_common.h:126
std::unordered_map< std::string, std::shared_ptr< YieldSignInfo > > YieldSignTable
Definition: hdmap_impl.h:68
int LoadMapFromProto(const Map &map_proto)
load map from a protobuf message
Contains parameters of axis-aligned bounding box.
Definition: aaboxkdtree2d.h:46
std::unordered_map< std::string, std::shared_ptr< JunctionInfo > > JunctionTable
Definition: hdmap_impl.h:60
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