Apollo 10.0
自动驾驶开放平台
hdmap.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#pragma once
18
19#include <string>
20#include <utility>
21#include <vector>
22
23#include "modules/common_msgs/basic_msgs/geometry.pb.h"
24#include "modules/common_msgs/map_msgs/map_area.pb.h"
25#include "modules/common_msgs/map_msgs/map_barrier_gate.pb.h"
26#include "modules/common_msgs/map_msgs/map_clear_area.pb.h"
27#include "modules/common_msgs/map_msgs/map_crosswalk.pb.h"
28#include "modules/common_msgs/map_msgs/map_junction.pb.h"
29#include "modules/common_msgs/map_msgs/map_lane.pb.h"
30#include "modules/common_msgs/map_msgs/map_overlap.pb.h"
31#include "modules/common_msgs/map_msgs/map_parking_space.pb.h"
32#include "modules/common_msgs/map_msgs/map_road.pb.h"
33#include "modules/common_msgs/map_msgs/map_signal.pb.h"
34#include "modules/common_msgs/map_msgs/map_speed_bump.pb.h"
35#include "modules/common_msgs/map_msgs/map_stop_sign.pb.h"
36#include "modules/common_msgs/map_msgs/map_yield_sign.pb.h"
37
38#include "cyber/common/macros.h"
41
46namespace apollo {
47namespace hdmap {
48
54class HDMap {
55 public:
61 int LoadMapFromFile(const std::string& map_filename);
62
68 int LoadMapFromProto(const Map& map_proto);
69
70 LaneInfoConstPtr GetLaneById(const Id& id) const;
72 SignalInfoConstPtr GetSignalById(const Id& id) const;
78 OverlapInfoConstPtr GetOverlapById(const Id& id) const;
79 RoadInfoConstPtr GetRoadById(const Id& id) const;
82 RSUInfoConstPtr GetRSUById(const Id& id) const;
83 AreaInfoConstPtr GetAreaById(const Id& id) const;
85
93 int GetAreas(const apollo::common::PointENU& point, double distance,
94 std::vector<AreaInfoConstPtr>* areas) const;
95
103 int GetLanes(const apollo::common::PointENU& point, double distance,
104 std::vector<LaneInfoConstPtr>* lanes) const;
112 int GetJunctions(const apollo::common::PointENU& point, double distance,
113 std::vector<JunctionInfoConstPtr>* junctions) const;
121 int GetSignals(const apollo::common::PointENU& point, double distance,
122 std::vector<SignalInfoConstPtr>* signals) const;
130 int GetBarrierGates(const apollo::common::PointENU& point, double distance,
131 std::vector<BarrierGateInfoConstPtr>* barrier_gates) const;
139 int GetCrosswalks(const apollo::common::PointENU& point, double distance,
140 std::vector<CrosswalkInfoConstPtr>* crosswalks) const;
148 int GetStopSigns(const apollo::common::PointENU& point, double distance,
149 std::vector<StopSignInfoConstPtr>* stop_signs) const;
157 int GetYieldSigns(const apollo::common::PointENU& point, double distance,
158 std::vector<YieldSignInfoConstPtr>* yield_signs) const;
166 int GetClearAreas(const apollo::common::PointENU& point, double distance,
167 std::vector<ClearAreaInfoConstPtr>* clear_areas) const;
175 int GetSpeedBumps(const apollo::common::PointENU& point, double distance,
176 std::vector<SpeedBumpInfoConstPtr>* speed_bumps) const;
184 int GetRoads(const apollo::common::PointENU& point, double distance,
185 std::vector<RoadInfoConstPtr>* roads) const;
194 const apollo::common::PointENU& point, double distance,
195 std::vector<ParkingSpaceInfoConstPtr>* parking_spaces) const;
203 int GetPNCJunctions(
204 const apollo::common::PointENU& point, double distance,
205 std::vector<PNCJunctionInfoConstPtr>* pnc_junctions) const;
206
217 const double distance,
218 LaneInfoConstPtr* nearest_lane,
219 double* nearest_s, double* nearest_l) const;
220
230 LaneInfoConstPtr* nearest_lane, double* nearest_s,
231 double* nearest_l) const;
244 const double distance,
245 const double central_heading,
246 const double max_heading_difference,
247 LaneInfoConstPtr* nearest_lane,
248 double* nearest_s, double* nearest_l) const;
259 const double distance, const double central_heading,
260 const double max_heading_difference,
261 std::vector<LaneInfoConstPtr>* lanes) const;
270 int GetRoadBoundaries(const apollo::common::PointENU& point, double radius,
271 std::vector<RoadROIBoundaryPtr>* road_boundaries,
272 std::vector<JunctionBoundaryPtr>* junctions) const;
281 int GetRoadBoundaries(const apollo::common::PointENU& point, double radius,
282 std::vector<RoadRoiPtr>* road_boundaries,
283 std::vector<JunctionInfoConstPtr>* junctions) const;
292 int GetRoi(const apollo::common::PointENU& point, double radius,
293 std::vector<RoadRoiPtr>* roads_roi,
294 std::vector<PolygonRoiPtr>* polygons_roi);
305 const apollo::common::PointENU& point, const double distance,
306 std::vector<SignalInfoConstPtr>* signals) const;
307
316 const apollo::common::PointENU& point, const double distance,
317 std::vector<BarrierGateInfoConstPtr>* barrier_gates) const;
318
327 const Id& id, std::vector<StopSignInfoConstPtr>* stop_signs) const;
328
335 int GetStopSignAssociatedLanes(const Id& id,
336 std::vector<LaneInfoConstPtr>* lanes) const;
337
346 int GetLocalMap(const apollo::common::PointENU& point,
347 const std::pair<double, double>& range, Map* local_map) const;
348
359 double distance, double central_heading,
360 double max_heading_difference,
361 std::vector<RSUInfoConstPtr>* rsus) const;
362
363 bool GetMapHeader(Header* map_header) const;
364
365 private:
366 HDMapImpl impl_;
367};
368
369} // namespace hdmap
370} // namespace apollo
High-precision map loader implement.
Definition hdmap_impl.h:59
High-precision map loader interface.
Definition hdmap.h:54
RSUInfoConstPtr GetRSUById(const Id &id) const
StopSignInfoConstPtr GetStopSignById(const Id &id) const
Definition hdmap.cc:58
int GetSpeedBumps(const apollo::common::PointENU &point, double distance, std::vector< SpeedBumpInfoConstPtr > *speed_bumps) const
get all speed bumps in certain range
Definition hdmap.cc:138
PNCJunctionInfoConstPtr GetPNCJunctionById(const Id &id) const
Definition hdmap.cc:86
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
Definition hdmap.cc:188
YieldSignInfoConstPtr GetYieldSignById(const Id &id) const
Definition hdmap.cc:62
int GetSignals(const apollo::common::PointENU &point, double distance, std::vector< SignalInfoConstPtr > *signals) const
get all signals in certain range
Definition hdmap.cc:105
int GetCrosswalks(const apollo::common::PointENU &point, double distance, std::vector< CrosswalkInfoConstPtr > *crosswalks) const
get all crosswalks in certain range
Definition hdmap.cc:116
BarrierGateInfoConstPtr GetBarrierGateById(const Id &id) const
Definition hdmap.cc:50
ClearAreaInfoConstPtr GetClearAreaById(const Id &id) const
Definition hdmap.cc:66
int GetLanes(const apollo::common::PointENU &point, double distance, std::vector< LaneInfoConstPtr > *lanes) const
get all lanes in certain range
Definition hdmap.cc:90
LaneInfoConstPtr GetLaneById(const Id &id) const
Definition hdmap.cc:34
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
Definition hdmap.cc:176
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
Definition hdmap.cc:223
int LoadMapFromProto(const Map &map_proto)
load map from a given protobuf message.
Definition hdmap.cc:28
int GetAreas(const apollo::common::PointENU &point, double distance, std::vector< AreaInfoConstPtr > *areas) const
get all areas in certain range
Definition hdmap.cc:100
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
Definition hdmap.cc:229
int GetParkingSpaces(const apollo::common::PointENU &point, double distance, std::vector< ParkingSpaceInfoConstPtr > *parking_spaces) const
get all parking spaces in certain range
Definition hdmap.cc:149
AreaInfoConstPtr GetAreaById(const Id &id) const
Definition hdmap.cc:42
int GetRoads(const apollo::common::PointENU &point, double distance, std::vector< RoadInfoConstPtr > *roads) const
get all roads in certain range
Definition hdmap.cc:144
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
Definition hdmap.cc:245
int GetClearAreas(const apollo::common::PointENU &point, double distance, std::vector< ClearAreaInfoConstPtr > *clear_areas) const
get all clear areas in certain range
Definition hdmap.cc:132
RoadInfoConstPtr GetRoadById(const Id &id) const
Definition hdmap.cc:78
int GetNearestLane(const apollo::common::PointENU &point, LaneInfoConstPtr *nearest_lane, double *nearest_s, double *nearest_l) const
get nearest lane from target point,
Definition hdmap.cc:170
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...
Definition hdmap.cc:239
JunctionInfoConstPtr GetJunctionById(const Id &id) const
Definition hdmap.cc:38
int GetBarrierGates(const apollo::common::PointENU &point, double distance, std::vector< BarrierGateInfoConstPtr > *barrier_gates) const
get all barrier_gates in certain range
Definition hdmap.cc:110
int LoadMapFromFile(const std::string &map_filename)
load map from local file
Definition hdmap.cc:23
OverlapInfoConstPtr GetOverlapById(const Id &id) const
Definition hdmap.cc:74
int GetRoi(const apollo::common::PointENU &point, double radius, std::vector< RoadRoiPtr > *roads_roi, std::vector< PolygonRoiPtr > *polygons_roi)
get ROI within certain range
Definition hdmap.cc:211
int GetPNCJunctions(const apollo::common::PointENU &point, double distance, std::vector< PNCJunctionInfoConstPtr > *pnc_junctions) const
get all pnc junctions in certain range
Definition hdmap.cc:155
ParkingSpaceInfoConstPtr GetParkingSpaceById(const Id &id) const
Definition hdmap.cc:82
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
Definition hdmap.cc:197
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,
Definition hdmap.cc:161
bool GetMapHeader(Header *map_header) const
Definition hdmap.cc:254
int GetStopSignAssociatedLanes(const Id &id, std::vector< LaneInfoConstPtr > *lanes) const
get all lanes associated with a stop sign in the same junction
Definition hdmap.cc:234
CrosswalkInfoConstPtr GetCrosswalkById(const Id &id) const
Definition hdmap.cc:54
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 ...
Definition hdmap.cc:217
int GetYieldSigns(const apollo::common::PointENU &point, double distance, std::vector< YieldSignInfoConstPtr > *yield_signs) const
get all yield signs in certain range
Definition hdmap.cc:126
SignalInfoConstPtr GetSignalById(const Id &id) const
Definition hdmap.cc:46
int GetJunctions(const apollo::common::PointENU &point, double distance, std::vector< JunctionInfoConstPtr > *junctions) const
get all junctions in certain range
Definition hdmap.cc:95
SpeedBumpInfoConstPtr GetSpeedBumpById(const Id &id) const
Definition hdmap.cc:70
int GetStopSigns(const apollo::common::PointENU &point, double distance, std::vector< StopSignInfoConstPtr > *stop_signs) const
get all stop signs in certain range
Definition hdmap.cc:121
std::shared_ptr< const PNCJunctionInfo > PNCJunctionInfoConstPtr
std::shared_ptr< const JunctionInfo > JunctionInfoConstPtr
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< const YieldSignInfo > YieldSignInfoConstPtr
std::shared_ptr< const ParkingSpaceInfo > ParkingSpaceInfoConstPtr
std::shared_ptr< const OverlapInfo > OverlapInfoConstPtr
class register implement
Definition arena_queue.h:37