CARLA
 
载入中...
搜索中...
未找到
road/Junction.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
10#include "carla/NonCopyable.h"
12
13#include <unordered_map>
14#include <unordered_set>
15#include <vector>
16#include <string>
17
18namespace carla {
19namespace road {
20
21 class MapBuilder;
22
23 class Junction : private MovableNonCopyable {
24 public:
25
30
47
48 Junction(const JuncId id, const std::string name)
49 : _id(id),
50 _name(name),
51 _connections() {}
52
53 JuncId GetId() const {
54 return _id;
55 }
56
58 const auto search = _connections.find(id);
59 if (search != _connections.end()) {
60 return &search->second;
61 }
62 return nullptr;
63 }
64
65 std::unordered_map<ConId, Connection> &GetConnections() {
66 return _connections;
67 }
68
69 std::unordered_map<ConId, Connection> GetConnections() const {
70 return _connections;
71 }
72
76
77 bool RoadHasConflicts(RoadId road_id) const {
78 return _road_conflicts.count(road_id) > 0;
79 }
80
81 const std::unordered_set<RoadId> & GetConflictsOfRoad(RoadId road_id) const {
82 return _road_conflicts.at(road_id);
83 }
84
85 const std::set<ContId>& GetControllers() const {
86 return _controllers;
87 }
88
89 private:
90
91 friend MapBuilder;
92
94
95 std::string _name;
96
97 std::unordered_map<ConId, Connection> _connections;
98
99 std::set<ContId> _controllers;
100
101 std::unordered_map<RoadId, std::unordered_set<RoadId>>
103
105 };
106
107} // road
108} // carla
Inherit (privately) to suppress copy construction and assignment.
const std::set< ContId > & GetControllers() const
carla::geom::BoundingBox _bounding_box
const std::unordered_set< RoadId > & GetConflictsOfRoad(RoadId road_id) const
JuncId GetId() const
std::unordered_map< RoadId, std::unordered_set< RoadId > > _road_conflicts
Junction(const JuncId id, const std::string name)
Connection * GetConnection(ConId id)
std::unordered_map< ConId, Connection > GetConnections() const
std::set< ContId > _controllers
std::unordered_map< ConId, Connection > & GetConnections()
carla::geom::BoundingBox GetBoundingBox() const
std::unordered_map< ConId, Connection > _connections
bool RoadHasConflicts(RoadId road_id) const
int32_t JuncId
Definition RoadTypes.h:17
int32_t LaneId
Definition RoadTypes.h:19
uint32_t RoadId
Definition RoadTypes.h:15
uint32_t ConId
Definition RoadTypes.h:27
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133
void AddLaneLink(LaneId from, LaneId to)
Connection(ConId id, RoadId incoming_road, RoadId connecting_road)
std::vector< LaneLink > lane_links