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

#include <Road.h>

Inheritance diagram for carla::road::Road:

Public Member Functions

element::DirectedPoint GetDirectedPointIn (const double s) const
 Returns a directed point on the center of the road (lane 0), with the corresponding laneOffset and elevation records applied, on distance "s".
element::DirectedPoint GetDirectedPointInNoLaneOffset (const double s) const
 Returns a directed point on the center of the road (lane 0), with the corresponding laneOffset and elevation records applied, on distance "s".
const geom::CubicPolynomial & GetElevationOn (const double s) const
LaneSection * GetEndSection (LaneId id)
 Get the end section (from road coordinates s) given a lane id.
RoadId GetId () const
template<typename T>
const T * GetInfo (const double s) const
template<typename T>
std::vector< const T * > GetInfos () const
template<typename T>
std::vector< const T * > GetInfosInRange (const double min_s, const double max_s) const
JuncId GetJunctionId () const
Lane & GetLaneByDistance (double s, LaneId lane_id)
const Lane & GetLaneByDistance (double s, LaneId lane_id) const
Lane & GetLaneById (SectionId section_id, LaneId lane_id)
const Lane & GetLaneById (SectionId section_id, LaneId lane_id) const
std::map< LaneId, const Lane * > GetLanesAt (const double s) const
 Get all lanes at a given s.
std::vector< Lane * > GetLanesByDistance (double s)
 Get all lanes from all lane sections in a specific s.
std::vector< const Lane * > GetLanesByDistance (double s) const
LaneSection & GetLaneSectionById (SectionId id)
const LaneSection & GetLaneSectionById (SectionId id) const
auto GetLaneSections () const
auto GetLaneSectionsAt (const double s)
auto GetLaneSectionsAt (const double s) const
double GetLateralShapeZ (const double s, const double t) const
 Surface height offset from the <lateralProfile><shape> records at (s, t).
double GetLength () const
const MapData * GetMap () const
std::string GetName () const
const std::pair< const Lane *, double > GetNearestLane (const double s, const geom::Location &loc, uint32_t type=static_cast< uint32_t >(Lane::LaneType::Any)) const
 Returns a pointer to the nearest lane, given s relative to Road and a location.
const std::pair< double, double > GetNearestPoint (const geom::Location &loc) const
 Returns a pair containing:
Lane * GetNextLane (const double s, const LaneId lane_id)
std::vector< Road * > GetNexts () const
RoadId GetPredecessor () const
Lane * GetPrevLane (const double s, const LaneId lane_id)
std::vector< Road * > GetPrevs () const
LaneSection * GetStartSection (LaneId id)
 Get the start section (from road coordinates s) given a lane id.
RoadId GetSuccessor () const
bool IsJunction () const
bool IsRHT () const
 Road ()=default
double UpperBound (double s) const
 Return the upper bound "s", i.e., the end distance of the lane section at s (clamped at road's length).

Static Private Member Functions

template<typename MultiMapT>
static auto GetLessEqualRange (MultiMapT &map, double s)

Private Attributes

RoadId _id { 0 }
InformationSet _info
bool _is_junction { false }
bool _is_rht { true }
JuncId _junction_id { -1 }
LaneSectionMap _lane_sections
double _length { 0.0 }
MapData * _map_data { nullptr }
std::string _name
std::vector< Road * > _nexts
RoadId _predecessor { 0 }
std::vector< Road * > _prevs
RoadId _successor { 0 }
friend MapBuilder

Additional Inherited Members

Private Member Functions inherited from carla::MovableNonCopyable
 MovableNonCopyable ()=default
 MovableNonCopyable (const MovableNonCopyable &)=delete
 MovableNonCopyable (MovableNonCopyable &&)=default
MovableNonCopyable & operator= (const MovableNonCopyable &)=delete
MovableNonCopyable & operator= (MovableNonCopyable &&)=default

Detailed Description

Definition at line 32 of file road/Road.h.

Constructor & Destructor Documentation

◆ Road()

Member Function Documentation

◆ GetDirectedPointIn()

element::DirectedPoint carla::road::Road::GetDirectedPointIn ( const double s) const

Returns a directed point on the center of the road (lane 0), with the corresponding laneOffset and elevation records applied, on distance "s".

  • @ param s distance regarding the road to compute the point

Definition at line 246 of file road/Road.cpp.

References _info, _length, carla::road::element::DirectedPoint::ApplyLateralOffset(), carla::geom::Math::Clamp(), GetElevationOn(), carla::road::InformationSet::GetInfo(), carla::road::element::DirectedPoint::location, carla::road::element::DirectedPoint::pitch, and carla::geom::Vector3D::z.

Referenced by GetNearestLane(), carla::client::Road::GetTransformAt(), and Road().

◆ GetDirectedPointInNoLaneOffset()

element::DirectedPoint carla::road::Road::GetDirectedPointInNoLaneOffset ( const double s) const

Returns a directed point on the center of the road (lane 0), with the corresponding laneOffset and elevation records applied, on distance "s".

  • @ param s distance regarding the road to compute the point

Definition at line 268 of file road/Road.cpp.

References _info, _length, carla::geom::Math::Clamp(), GetElevationOn(), and carla::road::InformationSet::GetInfo().

Referenced by carla::road::MapBuilder::ComputeSignalTransform(), carla::road::MapBuilder::ComputeStencilTransform(), and Road().

◆ GetElevationOn()

const geom::CubicPolynomial & carla::road::Road::GetElevationOn ( const double s) const

Definition at line 72 of file road/Road.cpp.

References GetInfo(), and carla::throw_exception().

Referenced by GetDirectedPointIn(), GetDirectedPointInNoLaneOffset(), and Road().

◆ GetEndSection()

LaneSection * carla::road::Road::GetEndSection ( LaneId id)

Get the end section (from road coordinates s) given a lane id.

Definition at line 173 of file road/Road.cpp.

References _lane_sections.

Referenced by Road().

◆ GetId()

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

Definition at line 32 of file road/Road.cpp.

References _id.

Referenced by Road().

◆ GetInfo()

template<typename T>
const T * carla::road::Road::GetInfo ( const double s) const
inline

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

References _info, and carla::road::InformationSet::GetInfo().

Referenced by GetElevationOn().

◆ GetInfos()

template<typename T>
std::vector< const T * > carla::road::Road::GetInfos ( ) const
inline

Definition at line 127 of file road/Road.h.

References _info, and carla::road::InformationSet::GetInfos().

◆ GetInfosInRange()

template<typename T>
std::vector< const T * > carla::road::Road::GetInfosInRange ( const double min_s,
const double max_s ) const
inline

Definition at line 132 of file road/Road.h.

References _info, and carla::road::InformationSet::GetInfos().

◆ GetJunctionId()

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

◆ GetLaneByDistance() [1/2]

Lane & carla::road::Road::GetLaneByDistance ( double s,
LaneId lane_id )

◆ GetLaneByDistance() [2/2]

const Lane & carla::road::Road::GetLaneByDistance ( double s,
LaneId lane_id ) const

Definition at line 90 of file road/Road.cpp.

References GetLaneByDistance(), and Road().

◆ GetLaneById() [1/2]

Lane & carla::road::Road::GetLaneById ( SectionId section_id,
LaneId lane_id )

◆ GetLaneById() [2/2]

const Lane & carla::road::Road::GetLaneById ( SectionId section_id,
LaneId lane_id ) const

Definition at line 120 of file road/Road.cpp.

References GetLaneById(), and Road().

◆ GetLanesAt()

std::map< LaneId, const Lane * > carla::road::Road::GetLanesAt ( const double s) const

Get all lanes at a given s.

Definition at line 373 of file road/Road.cpp.

References GetLaneSectionsAt().

Referenced by GetNearestLane().

◆ GetLanesByDistance() [1/2]

std::vector< Lane * > carla::road::Road::GetLanesByDistance ( double s)

Get all lanes from all lane sections in a specific s.

Definition at line 94 of file road/Road.cpp.

References GetLaneSectionsAt().

Referenced by Road().

◆ GetLanesByDistance() [2/2]

std::vector< const Lane * > carla::road::Road::GetLanesByDistance ( double s) const

Definition at line 105 of file road/Road.cpp.

References GetLaneSectionsAt().

◆ GetLaneSectionById() [1/2]

LaneSection & carla::road::Road::GetLaneSectionById ( SectionId id)
inline

Definition at line 172 of file road/Road.h.

References _lane_sections, and carla::road::LaneSectionMap::GetById().

Referenced by GetLaneById(), and carla::road::IsLanePresent().

◆ GetLaneSectionById() [2/2]

const LaneSection & carla::road::Road::GetLaneSectionById ( SectionId id) const
inline

Definition at line 176 of file road/Road.h.

References _lane_sections, and carla::road::LaneSectionMap::GetById().

◆ GetLaneSections()

auto carla::road::Road::GetLaneSections ( ) const
inline

Definition at line 136 of file road/Road.h.

References _lane_sections.

◆ GetLaneSectionsAt() [1/2]

auto carla::road::Road::GetLaneSectionsAt ( const double s)
inline

◆ GetLaneSectionsAt() [2/2]

auto carla::road::Road::GetLaneSectionsAt ( const double s) const
inline

Definition at line 165 of file road/Road.h.

References _lane_sections, and GetLessEqualRange().

◆ GetLateralShapeZ()

double carla::road::Road::GetLateralShapeZ ( const double s,
const double t ) const

Surface height offset from the <lateralProfile><shape> records at (s, t).

Returns 0 when the road has no shape records. Interpolates linearly between the two bracketing s-stations; within a station the record with the greatest t <= query t applies (clamped to the first record below its t range).

Definition at line 187 of file road/Road.cpp.

References _info, _length, carla::geom::Math::Clamp(), carla::road::element::RoadInfoLateralShape::Evaluate(), and carla::road::InformationSet::GetInfos().

Referenced by Road().

◆ GetLength()

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

Definition at line 40 of file road/Road.cpp.

References _length.

Referenced by carla::client::Road::GetLength(), and Road().

◆ GetLessEqualRange()

template<typename MultiMapT>
auto carla::road::Road::GetLessEqualRange ( MultiMapT & map,
double s )
inlinestaticprivate

Definition at line 145 of file road/Road.h.

Referenced by GetLaneSectionsAt(), and GetLaneSectionsAt().

◆ GetMap()

const MapData * carla::road::Road::GetMap ( ) const

Definition at line 28 of file road/Road.cpp.

References _map_data.

Referenced by carla::client::GetRoadData(), and Road().

◆ GetName()

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

Definition at line 36 of file road/Road.cpp.

References _name.

Referenced by carla::client::Road::GetName(), and Road().

◆ GetNearestLane()

const std::pair< const Lane *, double > carla::road::Road::GetNearestLane ( const double s,
const geom::Location & loc,
uint32_t type = static_cast<uint32_t>(Lane::LaneType::Any) ) const

Returns a pointer to the nearest lane, given s relative to Road and a location.

Parameters
sdistance from the begining of the road to the point you want to calculate the distance
locpoint to calculate the distance

Definition at line 307 of file road/Road.cpp.

References carla::road::element::DirectedPoint::ApplyLateralOffset(), carla::geom::Math::Distance(), GetDirectedPointIn(), GetLanesAt(), and carla::road::element::DirectedPoint::location.

Referenced by Road().

◆ GetNearestPoint()

const std::pair< double, double > carla::road::Road::GetNearestPoint ( const geom::Location & loc) const

Returns a pair containing:

  • first: distance to the nearest point on the center in this road segment from the begining of it (s).
  • second: Euclidean distance from the nearest point in this road segment to p.
    Parameters
    locpoint to calculate the distance

Definition at line 282 of file road/Road.cpp.

References _info, DEBUG_ASSERT, and carla::road::InformationSet::GetInfos().

Referenced by Road().

◆ GetNextLane()

Lane * carla::road::Road::GetNextLane ( const double s,
const LaneId lane_id )

Definition at line 125 of file road/Road.cpp.

References _lane_sections.

Referenced by Road().

◆ GetNexts()

std::vector< Road * > carla::road::Road::GetNexts ( ) const

Definition at line 64 of file road/Road.cpp.

References _nexts.

Referenced by Road().

◆ GetPredecessor()

RoadId carla::road::Road::GetPredecessor ( ) const

Definition at line 60 of file road/Road.cpp.

References _predecessor.

Referenced by carla::client::Road::GetPredecessorId(), and Road().

◆ GetPrevLane()

Lane * carla::road::Road::GetPrevLane ( const double s,
const LaneId lane_id )

Definition at line 142 of file road/Road.cpp.

References _lane_sections.

Referenced by Road().

◆ GetPrevs()

std::vector< Road * > carla::road::Road::GetPrevs ( ) const

Definition at line 68 of file road/Road.cpp.

References _prevs.

Referenced by Road().

◆ GetStartSection()

LaneSection * carla::road::Road::GetStartSection ( LaneId id)

Get the start section (from road coordinates s) given a lane id.

Definition at line 160 of file road/Road.cpp.

References _lane_sections.

Referenced by Road().

◆ GetSuccessor()

RoadId carla::road::Road::GetSuccessor ( ) const

Definition at line 56 of file road/Road.cpp.

References _successor.

Referenced by carla::client::Road::GetSuccessorId(), and Road().

◆ IsJunction()

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

◆ IsRHT()

◆ UpperBound()

double carla::road::Road::UpperBound ( double s) const
inline

Return the upper bound "s", i.e., the end distance of the lane section at s (clamped at road's length).

Definition at line 182 of file road/Road.h.

References _lane_sections, and _length.

Member Data Documentation

◆ _id

RoadId carla::road::Road::_id { 0 }
private

Definition at line 196 of file road/Road.h.

Referenced by GetId().

◆ _info

◆ _is_junction

bool carla::road::Road::_is_junction { false }
private

Definition at line 202 of file road/Road.h.

Referenced by IsJunction().

◆ _is_rht

bool carla::road::Road::_is_rht { true }
private

Definition at line 206 of file road/Road.h.

Referenced by IsRHT().

◆ _junction_id

JuncId carla::road::Road::_junction_id { -1 }
private

Definition at line 204 of file road/Road.h.

Referenced by GetJunctionId().

◆ _lane_sections

◆ _length

double carla::road::Road::_length { 0.0 }
private

◆ _map_data

MapData* carla::road::Road::_map_data { nullptr }
private

Definition at line 194 of file road/Road.h.

Referenced by GetMap().

◆ _name

std::string carla::road::Road::_name
private

Definition at line 198 of file road/Road.h.

Referenced by GetName().

◆ _nexts

std::vector<Road *> carla::road::Road::_nexts
private

Definition at line 216 of file road/Road.h.

Referenced by GetNexts().

◆ _predecessor

RoadId carla::road::Road::_predecessor { 0 }
private

Definition at line 212 of file road/Road.h.

Referenced by GetPredecessor().

◆ _prevs

std::vector<Road *> carla::road::Road::_prevs
private

Definition at line 218 of file road/Road.h.

Referenced by GetPrevs().

◆ _successor

RoadId carla::road::Road::_successor { 0 }
private

Definition at line 210 of file road/Road.h.

Referenced by GetSuccessor().

◆ MapBuilder

friend carla::road::Road::MapBuilder
private

Definition at line 192 of file road/Road.h.


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