CARLA
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
carla::client::Lane Class Reference

A single OpenDRIVE lane, identified by (road id, lane section id, lane id). More...

#include <Lane.h>

+ Inheritance diagram for carla::client::Lane:

Public Member Functions

double GetDistance () const
 The s coordinate, along the road, at which this lane's section begins.
 
road::LaneId GetId () const
 
SharedPtr< Lane > GetLeftLane () const
 The lane to the left, or nullptr. See GetRightLane() on direction.
 
double GetLength () const
 Length of the lane, in metres.
 
bool GetLevel () const
 
std::vector< SharedPtr< Lane > > GetNextLanes () const
 Lanes this one leads into. Empty where the lane ends.
 
std::vector< SharedPtr< Lane > > GetPreviousLanes () const
 Lanes leading into this one.
 
SharedPtr< Lane > GetRightLane () const
 The lane to the right, or nullptr at the edge of the road.
 
SharedPtr< Road > GetRoad () const
 
road::RoadId GetRoadId () const
 
SharedPtr< LaneSection > GetSection () const
 
road::SectionId GetSectionId () const
 
geom::Transform GetTransform (double s) const
 
road::Lane::LaneType GetType () const
 
uint64_t GetUniqueId () const
 Unique id of this lane within its map, for use as a dictionary key.
 
SharedPtr< Waypoint > GetWaypoint (double s) const
 The waypoint on this lane at road coordinate s, or nullptr when s falls outside the lane.
 
std::vector< SharedPtr< Waypoint > > GetWaypoints (double distance) const
 Waypoints along this lane, every distance metres.
 
double GetWidth (double s) const
 Lane width at the given s, in metres.
 
bool IsPositiveDirection () const
 Whether the lane runs along increasing s (a right-hand lane, id < 0).
 
bool IsStraight () const
 
bool operator!= (const Lane &rhs) const
 
bool operator== (const Lane &rhs) const
 

Private Member Functions

const road::Lane & GetLane () const
 The underlying OpenDRIVE lane. Valid only while _parent is alive.
 
 Lane (SharedPtr< const Map > parent, road::RoadId road_id, road::SectionId section_id, road::LaneId lane_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

road::LaneId _lane_id
 
SharedPtr< const Map > _parent
 
road::RoadId _road_id
 
road::SectionId _section_id
 

Friends

class Junction
 
class LaneSection
 
class Map
 
class Road
 
class Waypoint
 

Detailed Description

A single OpenDRIVE lane, identified by (road id, lane section id, lane id).

A lane lives inside exactly one lane section, which is why its identity carries the section: the same lane id on the same road is a different lane in a different section. Following GetNextLanes() can therefore cross into another section, or return nothing where the lane simply ends.

Like carla::client::Junction, this holds the parent map alive and resolves its ids on each call rather than caching a road::Lane pointer, which would dangle once the map is released.

Definition at line 35 of file client/Lane.h.

Constructor & Destructor Documentation

◆ Lane()

carla::client::Lane::Lane ( SharedPtr< const Map >  parent,
road::RoadId  road_id,
road::SectionId  section_id,
road::LaneId  lane_id 
)
inlineprivate

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

Member Function Documentation

◆ GetDistance()

double carla::client::Lane::GetDistance ( ) const

The s coordinate, along the road, at which this lane's section begins.

Definition at line 66 of file client/Lane.cpp.

References carla::road::Lane::GetDistance(), and GetLane().

Referenced by carla::client::JunctionSideDistance().

◆ GetId()

road::LaneId carla::client::Lane::GetId ( ) const
inline

Definition at line 40 of file client/Lane.h.

References _lane_id.

◆ GetLane()

const road::Lane & carla::client::Lane::GetLane ( ) const
private

◆ GetLeftLane()

SharedPtr< Lane > carla::client::Lane::GetLeftLane ( ) const

◆ GetLength()

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

Length of the lane, in metres.

Definition at line 62 of file client/Lane.cpp.

References GetLane(), and carla::road::Lane::GetLength().

Referenced by carla::client::JunctionSideDistance().

◆ GetLevel()

bool carla::client::Lane::GetLevel ( ) const

Definition at line 70 of file client/Lane.cpp.

References GetLane(), and carla::road::Lane::GetLevel().

◆ GetNextLanes()

std::vector< SharedPtr< Lane > > carla::client::Lane::GetNextLanes ( ) const

Lanes this one leads into. Empty where the lane ends.

Definition at line 108 of file client/Lane.cpp.

References _parent, GetLane(), and carla::road::Lane::GetNextLanes().

◆ GetPreviousLanes()

std::vector< SharedPtr< Lane > > carla::client::Lane::GetPreviousLanes ( ) const

Lanes leading into this one.

Definition at line 120 of file client/Lane.cpp.

References _parent, GetLane(), and carla::road::Lane::GetPreviousLanes().

◆ GetRightLane()

SharedPtr< Lane > carla::client::Lane::GetRightLane ( ) const

The lane to the right, or nullptr at the edge of the road.

Crossing the centre line flips the sign of the lane id, so the neighbour returned may run in the opposite direction; this matches Waypoint::GetRight().

Definition at line 90 of file client/Lane.cpp.

References _lane_id, _parent, _road_id, _section_id, GetLane(), carla::road::Lane::GetRoad(), carla::road::Road::IsRHT(), carla::client::StepInward(), and carla::client::StepOutward().

◆ GetRoad()

SharedPtr< Road > carla::client::Lane::GetRoad ( ) const

Definition at line 54 of file client/Lane.cpp.

References _parent, and _road_id.

◆ GetRoadId()

road::RoadId carla::client::Lane::GetRoadId ( ) const
inline

Definition at line 44 of file client/Lane.h.

References _road_id.

◆ GetSection()

SharedPtr< LaneSection > carla::client::Lane::GetSection ( ) const

Definition at line 58 of file client/Lane.cpp.

References _parent, _road_id, and _section_id.

◆ GetSectionId()

road::SectionId carla::client::Lane::GetSectionId ( ) const
inline

Definition at line 48 of file client/Lane.h.

References _section_id.

◆ GetTransform()

geom::Transform carla::client::Lane::GetTransform ( double  s) const

Definition at line 86 of file client/Lane.cpp.

References carla::road::Lane::ComputeTransform(), and GetLane().

◆ GetType()

road::Lane::LaneType carla::client::Lane::GetType ( ) const

Definition at line 50 of file client/Lane.cpp.

References GetLane(), and carla::road::Lane::GetType().

◆ GetUniqueId()

uint64_t carla::client::Lane::GetUniqueId ( ) const

Unique id of this lane within its map, for use as a dictionary key.

Definition at line 42 of file client/Lane.cpp.

References _lane_id, _road_id, and _section_id.

◆ GetWaypoint()

SharedPtr< Waypoint > carla::client::Lane::GetWaypoint ( double  s) const

The waypoint on this lane at road coordinate s, or nullptr when s falls outside the lane.

Definition at line 132 of file client/Lane.cpp.

References _lane_id, _parent, _road_id, _section_id, carla::road::Lane::GetDistance(), GetLane(), and carla::road::Lane::GetLength().

◆ GetWaypoints()

std::vector< SharedPtr< Waypoint > > carla::client::Lane::GetWaypoints ( double  distance) const

Waypoints along this lane, every distance metres.

Definition at line 143 of file client/Lane.cpp.

References _parent, distance, carla::road::Lane::GetDistance(), GetLane(), and carla::road::Lane::GetLength().

◆ GetWidth()

double carla::client::Lane::GetWidth ( double  s) const

Lane width at the given s, in metres.

s is a road coordinate, not an offset from the start of the lane.

Definition at line 82 of file client/Lane.cpp.

References GetLane(), and carla::road::Lane::GetWidth().

◆ IsPositiveDirection()

bool carla::client::Lane::IsPositiveDirection ( ) const

Whether the lane runs along increasing s (a right-hand lane, id < 0).

Definition at line 78 of file client/Lane.cpp.

References GetLane(), and carla::road::Lane::IsPositiveDirection().

Referenced by carla::client::JunctionSideDistance().

◆ IsStraight()

bool carla::client::Lane::IsStraight ( ) const

Definition at line 74 of file client/Lane.cpp.

References GetLane(), and carla::road::Lane::IsStraight().

◆ operator!=()

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

Definition at line 107 of file client/Lane.h.

◆ operator==()

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

Definition at line 101 of file client/Lane.h.

References _lane_id, _road_id, and _section_id.

Friends And Related Symbol Documentation

◆ Junction

friend class Junction
friend

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

◆ LaneSection

friend class LaneSection
friend

Definition at line 115 of file client/Lane.h.

◆ Map

friend class Map
friend

Definition at line 113 of file client/Lane.h.

◆ Road

friend class Road
friend

Definition at line 114 of file client/Lane.h.

◆ Waypoint

friend class Waypoint
friend

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

Member Data Documentation

◆ _lane_id

road::LaneId carla::client::Lane::_lane_id
private

◆ _parent

SharedPtr<const Map> carla::client::Lane::_parent
private

◆ _road_id

road::RoadId carla::client::Lane::_road_id
private

◆ _section_id

road::SectionId carla::client::Lane::_section_id
private

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