CARLA
Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
carla::road::Road Class Reference

#include <Road.h>

+ Inheritance diagram for carla::road::Road:
+ Collaboration 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". More...
 
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". More...
 
const geom::CubicPolynomialGetElevationOn (const double s) const
 
LaneSectionGetEndSection (LaneId id)
 Get the end section (from road coordinates s) given a lane id. More...
 
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
 
LaneGetLaneByDistance (double s, LaneId lane_id)
 
const LaneGetLaneByDistance (double s, LaneId lane_id) const
 
LaneGetLaneById (SectionId section_id, LaneId lane_id)
 
const LaneGetLaneById (SectionId section_id, LaneId lane_id) const
 
std::map< LaneId, const Lane * > GetLanesAt (const double s) const
 Get all lanes at a given s. More...
 
std::vector< Lane * > GetLanesByDistance (double s)
 Get all lanes from all lane sections in a specific s. More...
 
std::vector< const Lane * > GetLanesByDistance (double s) const
 
LaneSectionGetLaneSectionById (SectionId id)
 
const LaneSectionGetLaneSectionById (SectionId id) const
 
auto GetLaneSections () const
 
auto GetLaneSectionsAt (const double s)
 
auto GetLaneSectionsAt (const double s) const
 
double GetLength () const
 
const MapDataGetMap () 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. More...
 
const std::pair< double, double > GetNearestPoint (const geom::Location &loc) const
 Returns a pair containing: More...
 
LaneGetNextLane (const double s, const LaneId lane_id)
 
std::vector< Road * > GetNexts () const
 
RoadId GetPredecessor () const
 
LaneGetPrevLane (const double s, const LaneId lane_id)
 
std::vector< Road * > GetPrevs () const
 
LaneSectionGetStartSection (LaneId id)
 Get the start section (from road coordinates s) given a lane id. More...
 
RoadId GetSuccessor () const
 
bool IsJunction () 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). More...
 

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 }
 
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
 
MovableNonCopyableoperator= (const MovableNonCopyable &)=delete
 
MovableNonCopyableoperator= (MovableNonCopyable &&)=default
 

Detailed Description

Definition at line 32 of file Road.h.

Constructor & Destructor Documentation

◆ Road()

carla::road::Road::Road ( )
default

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 180 of file 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 carla::road::Lane::ComputeTransform(), carla::road::Lane::GetCornerPositions(), and GetNearestLane().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 202 of file Road.cpp.

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

Referenced by carla::road::MapBuilder::ComputeSignalTransform().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetElevationOn()

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

Definition at line 66 of file Road.cpp.

References carla::throw_exception().

Referenced by GetDirectedPointIn(), and GetDirectedPointInNoLaneOffset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetEndSection()

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

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

Definition at line 167 of file Road.cpp.

References _lane_sections.

Referenced by carla::road::MapBuilder::GetEdgeLanePointer().

+ Here is the caller graph for this function:

◆ GetId()

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

Definition at line 30 of file Road.cpp.

References _id.

Referenced by carla::road::MapBuilder::AddSignal(), carla::road::MapBuilder::AddSignalReference(), carla::road::ForEachDrivableLane(), carla::road::ForEachDrivableLaneAt(), and carla::road::ForEachLane().

+ Here is the caller graph for this function:

◆ GetInfo()

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

Definition at line 113 of file Road.h.

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

Referenced by carla::road::Lane::ComputeTransform(), and carla::road::Lane::IsStraight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetInfos()

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

Definition at line 118 of file Road.h.

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

Referenced by carla::road::Lane::IsStraight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 123 of file Road.h.

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

+ Here is the call graph for this function:

◆ GetJunctionId()

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

Definition at line 46 of file Road.cpp.

References _junction_id.

◆ GetLaneByDistance() [1/2]

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

Definition at line 74 of file Road.cpp.

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

Referenced by carla::road::MapBuilder::GetLane(), and GetLaneByDistance().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLaneByDistance() [2/2]

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

Definition at line 84 of file Road.cpp.

References GetLaneByDistance().

+ Here is the call graph for this function:

◆ GetLaneById() [1/2]

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

Definition at line 110 of file Road.cpp.

References carla::road::LaneSection::GetLanes(), and GetLaneSectionById().

Referenced by carla::road::Map::GetLane(), GetLaneById(), and carla::road::MapData::GetLaneInfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLaneById() [2/2]

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

Definition at line 114 of file Road.cpp.

References GetLaneById().

+ Here is the call graph for this function:

◆ GetLanesAt()

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

Get all lanes at a given s.

Definition at line 307 of file Road.cpp.

References GetLaneSectionsAt().

Referenced by GetNearestLane(), and UpperBound().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 88 of file Road.cpp.

References GetLaneSectionsAt().

Referenced by carla::road::MapBuilder::GenerateDefaultValiditiesForSignalReferences().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLanesByDistance() [2/2]

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

Definition at line 99 of file Road.cpp.

References GetLaneSectionsAt().

+ Here is the call graph for this function:

◆ GetLaneSectionById() [1/2]

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

Definition at line 163 of file Road.h.

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLaneSectionById() [2/2]

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

Definition at line 167 of file Road.h.

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

+ Here is the call graph for this function:

◆ GetLaneSections()

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

Definition at line 127 of file Road.h.

References _lane_sections, carla::iterator::make_map_values_const_iterator(), and carla::MakeListView().

Referenced by carla::road::ForEachDrivableLane(), carla::road::ForEachLane(), carla::geom::MeshFactory::Generate(), carla::geom::MeshFactory::GenerateWallsWithMaxLen(), and carla::geom::MeshFactory::GenerateWithMaxLen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLaneSectionsAt() [1/2]

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

Definition at line 149 of file Road.h.

References _lane_sections, GetLessEqualRange(), carla::iterator::make_map_values_iterator(), and carla::MakeListView().

Referenced by carla::road::ForEachDrivableLaneAt(), GetLaneByDistance(), GetLanesAt(), GetLanesByDistance(), and carla::road::Map::GetWaypoint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLaneSectionsAt() [2/2]

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

Definition at line 156 of file Road.h.

References _lane_sections, GetLessEqualRange(), carla::iterator::make_map_values_const_iterator(), and carla::MakeListView().

+ Here is the call graph for this function:

◆ GetLength()

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

Definition at line 38 of file Road.cpp.

References _length.

Referenced by carla::road::MapBuilder::AddSignalReference(), and carla::road::Map::GetWaypoint().

+ Here is the caller graph for this function:

◆ GetLessEqualRange()

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

Definition at line 136 of file Road.h.

Referenced by GetLaneSectionsAt().

+ Here is the caller graph for this function:

◆ GetMap()

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

Definition at line 26 of file Road.cpp.

References _map_data.

◆ GetName()

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

Definition at line 34 of file Road.cpp.

References _name.

◆ 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
distdistance from the begining of the road to the point you want to calculate the distance
locpoint to calculate the distance

Definition at line 241 of file Road.cpp.

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

+ Here is the call graph for this function:

◆ 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 216 of file Road.cpp.

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

+ Here is the call graph for this function:

◆ GetNextLane()

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

Definition at line 119 of file Road.cpp.

References _lane_sections.

Referenced by carla::road::MapBuilder::GetLaneNext().

+ Here is the caller graph for this function:

◆ GetNexts()

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

Definition at line 58 of file Road.cpp.

References _nexts.

◆ GetPredecessor()

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

Definition at line 54 of file Road.cpp.

References _predecessor.

Referenced by carla::road::MapBuilder::GetLaneNext().

+ Here is the caller graph for this function:

◆ GetPrevLane()

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

Definition at line 136 of file Road.cpp.

References _lane_sections.

Referenced by carla::road::MapBuilder::GetLaneNext().

+ Here is the caller graph for this function:

◆ GetPrevs()

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

Definition at line 62 of file Road.cpp.

References _prevs.

◆ GetStartSection()

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

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

Definition at line 154 of file Road.cpp.

References _lane_sections.

Referenced by carla::road::MapBuilder::GetEdgeLanePointer().

+ Here is the caller graph for this function:

◆ GetSuccessor()

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

Definition at line 50 of file Road.cpp.

References _successor.

Referenced by carla::road::MapBuilder::GetLaneNext().

+ Here is the caller graph for this function:

◆ IsJunction()

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

Definition at line 42 of file Road.cpp.

References _is_junction.

Referenced by carla::geom::MeshFactory::GenerateAllWithMaxLen(), and carla::road::Lane::GetCornerPositions().

+ Here is the caller graph for this function:

◆ 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 173 of file Road.h.

References _lane_sections, _length, and GetLanesAt().

+ Here is the call graph for this function:

Member Data Documentation

◆ _id

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

Definition at line 187 of file Road.h.

Referenced by GetId().

◆ _info

InformationSet carla::road::Road::_info
private

◆ _is_junction

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

Definition at line 193 of file Road.h.

Referenced by IsJunction().

◆ _junction_id

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

Definition at line 195 of file Road.h.

Referenced by GetJunctionId().

◆ _lane_sections

LaneSectionMap carla::road::Road::_lane_sections
private

◆ _length

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

Definition at line 191 of file Road.h.

Referenced by GetDirectedPointIn(), GetDirectedPointInNoLaneOffset(), GetLength(), and UpperBound().

◆ _map_data

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

Definition at line 185 of file Road.h.

Referenced by carla::road::MapBuilder::AddRoad(), and GetMap().

◆ _name

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

Definition at line 189 of file Road.h.

Referenced by GetName().

◆ _nexts

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

Definition at line 205 of file Road.h.

Referenced by GetNexts().

◆ _predecessor

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

Definition at line 201 of file Road.h.

Referenced by GetPredecessor().

◆ _prevs

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

Definition at line 207 of file Road.h.

Referenced by GetPrevs().

◆ _successor

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

Definition at line 199 of file Road.h.

Referenced by GetSuccessor().

◆ MapBuilder

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

Definition at line 183 of file Road.h.


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