CARLA
Loading...
Searching...
No Matches
carla::client::Road Class Reference

An OpenDRIVE road: a run of carriageway divided along s into lane sections, each holding the lanes. More...

#include <Road.h>

Inheritance diagram for carla::client::Road:

Public Member Functions

road::RoadId GetId () const
SharedPtr< Junction > GetJunction () const
 The junction this road belongs to, or nullptr when it is not part of one.
road::JuncId GetJunctionId () const
 Id of the junction this road belongs to, or -1 when it is not part of one.
SharedPtr< Lane > GetLane (road::SectionId section_id, road::LaneId lane_id) const
SharedPtr< Lane > GetLaneAt (double s, road::LaneId lane_id) const
 The lane with this id in whichever section covers s.
std::vector< SharedPtr< Lane > > GetLanes (double s, road::Lane::LaneType type=road::Lane::LaneType::Driving) const
 Every lane of the given type present at road coordinate s, across every lane section covering it.
double GetLength () const
 Length of the road, in metres.
std::string GetName () const
std::vector< SharedPtr< Road > > GetNextRoads () const
 Roads reachable by continuing forward.
road::RoadId GetPredecessorId () const
 Id of the road that precedes this one, as recorded in OpenDRIVE.
std::vector< SharedPtr< Road > > GetPreviousRoads () const
 Roads that lead into this one.
SharedPtr< LaneSection > GetSection (road::SectionId section_id) const
SharedPtr< LaneSection > GetSectionAt (double s) const
 The lane section covering road coordinate s, or nullptr.
std::vector< SharedPtr< LaneSection > > GetSections () const
road::RoadId GetSuccessorId () const
 Id of the road that follows this one, as recorded in OpenDRIVE.
geom::Transform GetTransformAt (double s) const
 Transform at the centre of the road at road coordinate s.
std::vector< SharedPtr< Waypoint > > GetWaypoints (double distance, road::Lane::LaneType type=road::Lane::LaneType::Driving) const
 Waypoints sampled along the road every distance metres, on every lane of the given type.
std::vector< SharedPtr< Waypoint > > GetWaypointsAt (double s, road::Lane::LaneType type=road::Lane::LaneType::Driving) const
 A cross-section: one waypoint per lane of the given type at s.
bool IsJunction () const
bool IsRHT () const
 Whether traffic on this road drives on the right.
bool operator!= (const Road &rhs) const
bool operator== (const Road &rhs) const

Private Member Functions

 Road (SharedPtr< const Map > parent, road::RoadId road_id)
Private Member Functions inherited from carla::NonCopyable
 NonCopyable ()=default
 NonCopyable (const NonCopyable &)=delete
 NonCopyable (NonCopyable &&)=delete
NonCopyable & operator= (const NonCopyable &)=delete
NonCopyable & operator= (NonCopyable &&)=delete

Private Attributes

SharedPtr< const Map > _parent
road::RoadId _road_id

Friends

class Junction
class Lane
class LaneSection
class Map
class Waypoint

Detailed Description

An OpenDRIVE road: a run of carriageway divided along s into lane sections, each holding the lanes.

Roads connect end to end through GetNextRoads() / GetPreviousRoads(), or through a junction. There is deliberately no left/right here: OpenDRIVE gives roads no lateral relation, since a road already contains the lanes on both sides of its centre line. Lateral neighbours live on Lane.

Definition at line 34 of file client/Road.h.

Constructor & Destructor Documentation

◆ Road()

carla::client::Road::Road ( SharedPtr< const Map > parent,
road::RoadId road_id )
inlineprivate

Definition at line 122 of file client/Road.h.

References _parent, and _road_id.

Referenced by operator!=(), and operator==().

Member Function Documentation

◆ GetId()

road::RoadId carla::client::Road::GetId ( ) const
inline

Definition at line 39 of file client/Road.h.

References _road_id.

◆ GetJunction()

SharedPtr< Junction > carla::client::Road::GetJunction ( ) const

The junction this road belongs to, or nullptr when it is not part of one.

Definition at line 135 of file client/Road.cpp.

References _parent, GetJunctionId(), and IsJunction().

◆ GetJunctionId()

road::JuncId carla::client::Road::GetJunctionId ( ) const

Id of the junction this road belongs to, or -1 when it is not part of one.

Definition at line 41 of file client/Road.cpp.

References _parent, _road_id, carla::road::Road::GetJunctionId(), and carla::client::GetRoadData().

Referenced by GetJunction().

◆ GetLane()

SharedPtr< Lane > carla::client::Road::GetLane ( road::SectionId section_id,
road::LaneId lane_id ) const

Definition at line 97 of file client/Road.cpp.

References _parent, and _road_id.

◆ GetLaneAt()

SharedPtr< Lane > carla::client::Road::GetLaneAt ( double s,
road::LaneId lane_id ) const

The lane with this id in whichever section covers s.

Definition at line 101 of file client/Road.cpp.

References _parent, _road_id, and GetSectionAt().

◆ GetLanes()

std::vector< SharedPtr< Lane > > carla::client::Road::GetLanes ( double s,
road::Lane::LaneType type = road::Lane::LaneType::Driving ) const

Every lane of the given type present at road coordinate s, across every lane section covering it.

Definition at line 81 of file client/Road.cpp.

References _parent, _road_id, and carla::client::GetRoadData().

Referenced by GetWaypointsAt().

◆ GetLength()

double carla::client::Road::GetLength ( ) const

Length of the road, in metres.

Definition at line 33 of file client/Road.cpp.

References _parent, _road_id, carla::road::Road::GetLength(), and carla::client::GetRoadData().

Referenced by GetWaypoints().

◆ GetName()

std::string carla::client::Road::GetName ( ) const

◆ GetNextRoads()

std::vector< SharedPtr< Road > > carla::client::Road::GetNextRoads ( ) const

Roads reachable by continuing forward.

Definition at line 57 of file client/Road.cpp.

References _parent, _road_id, and carla::client::GetRoadData().

◆ GetPredecessorId()

road::RoadId carla::client::Road::GetPredecessorId ( ) const

Id of the road that precedes this one, as recorded in OpenDRIVE.

Definition at line 53 of file client/Road.cpp.

References _parent, _road_id, carla::road::Road::GetPredecessor(), and carla::client::GetRoadData().

◆ GetPreviousRoads()

std::vector< SharedPtr< Road > > carla::client::Road::GetPreviousRoads ( ) const

Roads that lead into this one.

Definition at line 69 of file client/Road.cpp.

References _parent, _road_id, and carla::client::GetRoadData().

◆ GetSection()

SharedPtr< LaneSection > carla::client::Road::GetSection ( road::SectionId section_id) const

Definition at line 117 of file client/Road.cpp.

References _parent, and _road_id.

◆ GetSectionAt()

SharedPtr< LaneSection > carla::client::Road::GetSectionAt ( double s) const

The lane section covering road coordinate s, or nullptr.

Definition at line 121 of file client/Road.cpp.

References _parent, _road_id, carla::road::LaneSection::GetId(), and carla::client::GetRoadData().

Referenced by GetLaneAt().

◆ GetSections()

std::vector< SharedPtr< LaneSection > > carla::client::Road::GetSections ( ) const

Definition at line 109 of file client/Road.cpp.

References _parent, _road_id, and carla::client::GetRoadData().

◆ GetSuccessorId()

road::RoadId carla::client::Road::GetSuccessorId ( ) const

Id of the road that follows this one, as recorded in OpenDRIVE.

Definition at line 49 of file client/Road.cpp.

References _parent, _road_id, carla::client::GetRoadData(), and carla::road::Road::GetSuccessor().

◆ GetTransformAt()

geom::Transform carla::client::Road::GetTransformAt ( double s) const

◆ GetWaypoints()

std::vector< SharedPtr< Waypoint > > carla::client::Road::GetWaypoints ( double distance,
road::Lane::LaneType type = road::Lane::LaneType::Driving ) const

Waypoints sampled along the road every distance metres, on every lane of the given type.

Not to be confused with GetWaypointsAt(), which cuts across the road at a single s.

Definition at line 170 of file client/Road.cpp.

References GetLength(), and GetWaypointsAt().

◆ GetWaypointsAt()

std::vector< SharedPtr< Waypoint > > carla::client::Road::GetWaypointsAt ( double s,
road::Lane::LaneType type = road::Lane::LaneType::Driving ) const

A cross-section: one waypoint per lane of the given type at s.

Definition at line 157 of file client/Road.cpp.

References GetLanes().

Referenced by GetWaypoints().

◆ IsJunction()

bool carla::client::Road::IsJunction ( ) const

Definition at line 37 of file client/Road.cpp.

References _parent, _road_id, carla::client::GetRoadData(), and carla::road::Road::IsJunction().

Referenced by GetJunction().

◆ IsRHT()

bool carla::client::Road::IsRHT ( ) const

Whether traffic on this road drives on the right.

Definition at line 45 of file client/Road.cpp.

References _parent, _road_id, carla::client::GetRoadData(), and carla::road::Road::IsRHT().

◆ operator!=()

bool carla::client::Road::operator!= ( const Road & rhs) const
inline

Definition at line 110 of file client/Road.h.

References Road().

◆ operator==()

bool carla::client::Road::operator== ( const Road & rhs) const
inline

Definition at line 106 of file client/Road.h.

References _road_id, and Road().

◆ Junction

friend class Junction
friend

Definition at line 119 of file client/Road.h.

References Junction.

Referenced by Junction.

◆ Lane

friend class Lane
friend

Definition at line 117 of file client/Road.h.

References Lane.

Referenced by Lane.

◆ LaneSection

friend class LaneSection
friend

Definition at line 118 of file client/Road.h.

References LaneSection.

Referenced by LaneSection.

◆ Map

friend class Map
friend

Definition at line 116 of file client/Road.h.

References Map.

Referenced by Map.

◆ Waypoint

friend class Waypoint
friend

Definition at line 120 of file client/Road.h.

References Waypoint.

Referenced by Waypoint.

Member Data Documentation

◆ _parent

◆ _road_id


The documentation for this class was generated from the following files: