CARLA
Loading...
Searching...
No Matches
client/Junction.h
Go to the documentation of this file.
1// Copyright (c) 2026 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"
11#include "carla/road/Junction.h"
15
16#include <vector>
17
18namespace carla {
19namespace client {
20
21 class Map;
22 class Road;
23 class Lane;
24
26 : public EnableSharedFromThis<Junction>,
27 private NonCopyable
28 {
29 public:
30
32 return _id;
33 }
34
35 std::vector<std::pair<SharedPtr<Waypoint>,SharedPtr<Waypoint>>> GetWaypoints(
37
39
40 /// The roads *inside* the junction, carrying traffic through it. This is
41 /// OpenDRIVE's "connecting road"; the name is kept so the API agrees with
42 /// the .xodr.
43 std::vector<SharedPtr<Road>> GetConnectingRoads() const;
44
45 /// The roads *outside* the junction that meet it. OpenDRIVE calls these
46 /// "incoming", but a road has no inherent direction -- the same road is an
47 /// exit for traffic going the other way -- so they are adjacent here.
48 std::vector<SharedPtr<Road>> GetAdjacentRoads() const;
49
50 /// Lanes on the adjacent roads that feed into the junction.
51 std::vector<SharedPtr<Lane>> GetEntryLanes(
53
54 /// Lanes on the adjacent roads that the junction feeds into.
55 std::vector<SharedPtr<Lane>> GetExitLanes(
57
58 /// One waypoint per entry lane, on the adjacent road where it meets the
59 /// junction. Outside the junction, like GetEntryLanes(); for the waypoints
60 /// on the connecting roads inside it, use GetWaypoints().
61 std::vector<SharedPtr<Waypoint>> GetEntryWaypoints(
63
64 /// One waypoint per exit lane, on the adjacent road where it leaves the
65 /// junction.
66 std::vector<SharedPtr<Waypoint>> GetExitWaypoints(
68
69 private:
70
71 friend class Map;
72
73 /// Shared implementation of GetEntryLanes / GetExitLanes.
74 std::vector<SharedPtr<Lane>> GetNeighbourLanes(
76 bool entering) const;
77
78 /// Shared implementation of GetEntryWaypoints / GetExitWaypoints.
79 std::vector<SharedPtr<Waypoint>> GetNeighbourWaypoints(
81 bool entering) const;
82
84
86
88
90 };
91
92} // namespace client
93} // namespace carla
std::map< std::string, unsigned int > junction
Inherit (privately) to suppress copy/move construction and assignment.
std::vector< SharedPtr< Lane > > GetEntryLanes(road::Lane::LaneType type=road::Lane::LaneType::Driving) const
Lanes on the adjacent roads that feed into the junction.
Definition Junction.cpp:111
std::vector< SharedPtr< Waypoint > > GetExitWaypoints(road::Lane::LaneType type=road::Lane::LaneType::Driving) const
One waypoint per exit lane, on the adjacent road where it leaves the junction.
Definition Junction.cpp:154
std::vector< SharedPtr< Lane > > GetNeighbourLanes(road::Lane::LaneType type, bool entering) const
Shared implementation of GetEntryLanes / GetExitLanes.
Definition Junction.cpp:78
std::vector< SharedPtr< Waypoint > > GetEntryWaypoints(road::Lane::LaneType type=road::Lane::LaneType::Driving) const
One waypoint per entry lane, on the adjacent road where it meets the junction.
Definition Junction.cpp:150
std::vector< std::pair< SharedPtr< Waypoint >, SharedPtr< Waypoint > > > GetWaypoints(road::Lane::LaneType type=road::Lane::LaneType::Driving) const
Definition Junction.cpp:24
std::vector< SharedPtr< Waypoint > > GetNeighbourWaypoints(road::Lane::LaneType type, bool entering) const
Shared implementation of GetEntryWaypoints / GetExitWaypoints.
Definition Junction.cpp:137
geom::BoundingBox GetBoundingBox() const
Definition Junction.cpp:29
std::vector< SharedPtr< Lane > > GetExitLanes(road::Lane::LaneType type=road::Lane::LaneType::Driving) const
Lanes on the adjacent roads that the junction feeds into.
Definition Junction.cpp:115
std::vector< SharedPtr< Road > > GetAdjacentRoads() const
The roads outside the junction that meet it.
Definition Junction.cpp:53
carla::road::JuncId GetId() const
geom::BoundingBox _bounding_box
SharedPtr< const Map > _parent
std::vector< SharedPtr< Road > > GetConnectingRoads() const
The roads inside the junction, carrying traffic through it.
Definition Junction.cpp:33
LaneType
Can be used as flags.
Definition road/Lane.h:29
int32_t JuncId
Definition RoadTypes.h:17
This file contains definitions of common data structures used in traffic manager.
std::shared_ptr< T > SharedPtr
Definition Memory.h:15