CARLA
 
载入中...
搜索中...
未找到
client/Map.h
浏览该文件的文档.
1// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#pragma once
8
9#include "carla/Memory.h"
10#include "carla/NonCopyable.h"
12#include "carla/road/Lane.h"
13#include "carla/road/Map.h"
15#include "carla/rpc/MapInfo.h"
16#include "Landmark.h"
17
18#include <string>
19
20namespace carla {
21namespace geom { class GeoLocation; }
22namespace client {
23
24 class Waypoint;
25 class Junction;
26
27 class Map
28 : public EnableSharedFromThis<Map>,
29 private NonCopyable {
30 public:
31
32 explicit Map(rpc::MapInfo description, std::string xodr_content);
33
34 explicit Map(std::string name, std::string xodr_content);
35
37
38 const std::string &GetName() const {
39 return _description.name;
40 }
41
42 const road::Map &GetMap() const {
43 return _map;
44 }
45
46 const std::string &GetOpenDrive() const {
47 return open_drive_file;
48 }
49
50 const std::vector<geom::Transform> &GetRecommendedSpawnPoints() const {
52 }
53
55 const geom::Location &location,
56 bool project_to_road = true,
57 int32_t lane_type = static_cast<uint32_t>(road::Lane::LaneType::Driving)) const;
58
60 carla::road::RoadId road_id,
61 carla::road::LaneId lane_id,
62 float s) const;
63
64 using TopologyList = std::vector<std::pair<SharedPtr<Waypoint>, SharedPtr<Waypoint>>>;
65
67
68 std::vector<SharedPtr<Waypoint>> GenerateWaypoints(double distance) const;
69
70 std::vector<road::element::LaneMarking> CalculateCrossedLanes(
71 const geom::Location &origin,
72 const geom::Location &destination) const;
73
75
76 std::vector<geom::Location> GetAllCrosswalkZones() const;
77
78 SharedPtr<Junction> GetJunction(const Waypoint &waypoint) const;
79
80 /// Returns a pair of waypoints (start and end) for each lane in the
81 /// junction
82 std::vector<std::pair<SharedPtr<Waypoint>, SharedPtr<Waypoint>>> GetJunctionWaypoints(
83 road::JuncId id, road::Lane::LaneType type) const;
84
85 /// Returns all the larndmarks in the map
86 std::vector<SharedPtr<Landmark>> GetAllLandmarks() const;
87
88 /// Returns all the larndmarks in the map with a specific OpenDRIVE id
89 std::vector<SharedPtr<Landmark>> GetLandmarksFromId(std::string id) const;
90
91 /// Returns all the landmarks in the map of a specific type
92 std::vector<SharedPtr<Landmark>> GetAllLandmarksOfType(std::string type) const;
93
94 /// Returns all the landmarks in the same group including this one
95 std::vector<SharedPtr<Landmark>> GetLandmarkGroup(const Landmark &landmark) const;
96
97 /// Cooks InMemoryMap used by the traffic manager
98 void CookInMemoryMap(const std::string& path) const;
99
100 private:
101
102 std::string open_drive_file;
103
105
107 };
108
109} // namespace client
110} // namespace carla
Inherit (privately) to suppress copy/move construction and assignment.
Class containing a reference to RoadInfoSignal
Definition Landmark.h:22
const road::Map & GetMap() const
Definition client/Map.h:42
std::vector< geom::Location > GetAllCrosswalkZones() const
const std::string & GetOpenDrive() const
Definition client/Map.h:46
const std::vector< geom::Transform > & GetRecommendedSpawnPoints() const
Definition client/Map.h:50
SharedPtr< Waypoint > GetWaypointXODR(carla::road::RoadId road_id, carla::road::LaneId lane_id, float s) const
std::vector< std::pair< SharedPtr< Waypoint >, SharedPtr< Waypoint > > > TopologyList
Definition client/Map.h:64
SharedPtr< Junction > GetJunction(const Waypoint &waypoint) const
void CookInMemoryMap(const std::string &path) const
Cooks InMemoryMap used by the traffic manager
std::string open_drive_file
Definition client/Map.h:102
std::vector< SharedPtr< Landmark > > GetLandmarksFromId(std::string id) const
Returns all the larndmarks in the map with a specific OpenDRIVE id
std::vector< SharedPtr< Landmark > > GetAllLandmarksOfType(std::string type) const
Returns all the landmarks in the map of a specific type
TopologyList GetTopology() const
const rpc::MapInfo _description
Definition client/Map.h:104
const geom::GeoLocation & GetGeoReference() const
Map(rpc::MapInfo description, std::string xodr_content)
std::vector< SharedPtr< Landmark > > GetLandmarkGroup(const Landmark &landmark) const
Returns all the landmarks in the same group including this one
std::vector< road::element::LaneMarking > CalculateCrossedLanes(const geom::Location &origin, const geom::Location &destination) const
SharedPtr< Waypoint > GetWaypoint(const geom::Location &location, bool project_to_road=true, int32_t lane_type=static_cast< uint32_t >(road::Lane::LaneType::Driving)) const
const road::Map _map
Definition client/Map.h:106
std::vector< SharedPtr< Landmark > > GetAllLandmarks() const
Returns all the larndmarks in the map
const std::string & GetName() const
Definition client/Map.h:38
std::vector< SharedPtr< Waypoint > > GenerateWaypoints(double distance) const
std::vector< std::pair< SharedPtr< Waypoint >, SharedPtr< Waypoint > > > GetJunctionWaypoints(road::JuncId id, road::Lane::LaneType type) const
Returns a pair of waypoints (start and end) for each lane in the junction
LaneType
Can be used as flags
Definition Lane.h:29
std::string name
Definition MapInfo.h:21
std::vector< geom::Transform > recommended_spawn_points
Definition MapInfo.h:23
int32_t JuncId
Definition RoadTypes.h:17
int32_t LaneId
Definition RoadTypes.h:19
uint32_t RoadId
Definition RoadTypes.h:15
carla::SharedPtr< carla::client::Junction > Junction
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
Definition Memory.h:20