CARLA
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
carla::road::Map Class Reference

#include <Map.h>

+ Inheritance diagram for carla::road::Map:
+ Collaboration diagram for carla::road::Map:

Classes

struct  SignalSearchData
 Data structure for the signal search. More...
 

Public Types

using Waypoint = element::Waypoint
 

Public Member Functions

std::vector< element::LaneMarkingCalculateCrossedLanes (const geom::Location &origin, const geom::Location &destination) const
 
std::unordered_map< road::RoadId, std::unordered_set< road::RoadId > > ComputeJunctionConflicts (JuncId id) const
 
geom::Transform ComputeTransform (Waypoint waypoint) const
 
std::vector< std::unique_ptr< geom::Mesh > > GenerateChunkedMesh (const rpc::OpendriveGenerationParameters &params) const
 
geom::Mesh GenerateMesh (const double distance, const float extra_width=0.6f, const bool smooth_junctions=true) const
 Buids a mesh based on the OpenDRIVE. More...
 
std::vector< std::pair< Waypoint, Waypoint > > GenerateTopology () const
 Generate the minimum set of waypoints that define the topology of map. More...
 
geom::Mesh GenerateWalls (const double distance, const float wall_height) const
 
std::vector< WaypointGenerateWaypoints (double approx_distance) const
 Generate all the waypoints in map separated by approx_distance. More...
 
std::vector< WaypointGenerateWaypointsInRoad (RoadId road_id, Lane::LaneType lane_type=Lane::LaneType::Driving) const
 Generate waypoints at the entry of each lane of the specified road. More...
 
std::vector< WaypointGenerateWaypointsOnRoadEntries (Lane::LaneType lane_type=Lane::LaneType::Driving) const
 Generate waypoints on each lane at the start of each road. More...
 
geom::Mesh GetAllCrosswalkMesh () const
 Buids a mesh of all crosswalks based on the OpenDRIVE. More...
 
std::vector< geom::LocationGetAllCrosswalkZones () const
 Returns a list of locations defining 2d areas, when a location is repeated an area is finished. More...
 
std::vector< const element::RoadInfoSignal * > GetAllSignalReferences () const
 Return all RoadInfoSignal in the map. More...
 
boost::optional< element::WaypointGetClosestWaypointOnRoad (const geom::Location &location, int32_t lane_type=static_cast< int32_t >(Lane::LaneType::Driving)) const
 ========================================================================

– Geometry ---------------------------------------------------------—

More...
 
const std::unordered_map< ContId, std::unique_ptr< Controller > > & GetControllers () const
 
const geom::GeoLocationGetGeoReference () const
 ========================================================================

– Georeference -----------------------------------------------------—

More...
 
JunctionGetJunction (JuncId id)
 
const JunctionGetJunction (JuncId id) const
 
JuncId GetJunctionId (RoadId road_id) const
 
std::vector< std::pair< Waypoint, Waypoint > > GetJunctionWaypoints (JuncId id, Lane::LaneType lane_type) const
 Generate waypoints of the junction. More...
 
const LaneGetLane (Waypoint waypoint) const
 ========================================================================

Road information -------------------------------------------------—

More...
 
Lane::LaneType GetLaneType (Waypoint waypoint) const
 
double GetLaneWidth (Waypoint waypoint) const
 
boost::optional< WaypointGetLeft (Waypoint waypoint) const
 Return a waypoint at the lane of waypoint's left lane. More...
 
std::pair< const element::RoadInfoMarkRecord *, const element::RoadInfoMarkRecord * > GetMarkRecord (Waypoint waypoint) const
 
std::vector< WaypointGetNext (Waypoint waypoint, double distance) const
 Return the list of waypoints at distance such that a vehicle at waypoint could drive to. More...
 
std::vector< WaypointGetPredecessors (Waypoint waypoint) const
 
std::vector< WaypointGetPrevious (Waypoint waypoint, double distance) const
 Return the list of waypoints at distance in the reversed direction that a vehicle at waypoint could drive to. More...
 
boost::optional< WaypointGetRight (Waypoint waypoint) const
 Return a waypoint at the lane of waypoint's right lane. More...
 
const std::unordered_map< SignId, std::unique_ptr< Signal > > & GetSignals () const
 
std::vector< SignalSearchDataGetSignalsInDistance (Waypoint waypoint, double distance, bool stop_at_junction=false) const
 Searches signals from an initial waypoint until the defined distance. More...
 
std::vector< WaypointGetSuccessors (Waypoint waypoint) const
 ========================================================================

– Waypoint generation -------------------------------------------——

More...
 
boost::optional< element::WaypointGetWaypoint (const geom::Location &location, int32_t lane_type=static_cast< int32_t >(Lane::LaneType::Driving)) const
 
boost::optional< element::WaypointGetWaypoint (RoadId road_id, LaneId lane_id, float s) const
 
bool IsJunction (RoadId road_id) const
 
 Map (MapData m)
 ========================================================================

– Constructor ------------------------------------------------------—

More...
 

Private Types

using Rtree = geom::SegmentCloudRtree< Waypoint >
 

Private Member Functions

void AddElementToRtree (std::vector< Rtree::TreeElement > &rtree_elements, geom::Transform &current_transform, geom::Transform &next_transform, Waypoint &current_waypoint, Waypoint &next_waypoint)
 Helper Functions for constructing the rtree element list. More...
 
void AddElementToRtreeAndUpdateTransforms (std::vector< Rtree::TreeElement > &rtree_elements, geom::Transform &current_transform, Waypoint &current_waypoint, Waypoint &next_waypoint)
 
void CreateRtree ()
 
- Private Member Functions inherited from carla::MovableNonCopyable
 MovableNonCopyable ()=default
 
 MovableNonCopyable (const MovableNonCopyable &)=delete
 
 MovableNonCopyable (MovableNonCopyable &&)=default
 
MovableNonCopyableoperator= (const MovableNonCopyable &)=delete
 
MovableNonCopyableoperator= (MovableNonCopyable &&)=default
 

Private Attributes

MapData _data
 
Rtree _rtree
 
friend MapBuilder
 

Detailed Description

Definition at line 27 of file road/Map.h.

Member Typedef Documentation

◆ Rtree

Definition at line 186 of file road/Map.h.

◆ Waypoint

Definition at line 30 of file road/Map.h.

Constructor & Destructor Documentation

◆ Map()

carla::road::Map::Map ( MapData  m)
inline

========================================================================

– Constructor ------------------------------------------------------—

Definition at line 36 of file road/Map.h.

References CreateRtree().

+ Here is the call graph for this function:

Member Function Documentation

◆ AddElementToRtree()

void carla::road::Map::AddElementToRtree ( std::vector< Rtree::TreeElement > &  rtree_elements,
geom::Transform current_transform,
geom::Transform next_transform,
Waypoint current_waypoint,
Waypoint next_waypoint 
)
private

Helper Functions for constructing the rtree element list.

Definition at line 819 of file road/Map.cpp.

References carla::geom::Transform::location, carla::geom::Vector3D::x, carla::geom::Vector3D::y, and carla::geom::Vector3D::z.

◆ AddElementToRtreeAndUpdateTransforms()

void carla::road::Map::AddElementToRtreeAndUpdateTransforms ( std::vector< Rtree::TreeElement > &  rtree_elements,
geom::Transform current_transform,
Waypoint current_waypoint,
Waypoint next_waypoint 
)
private

Definition at line 840 of file road/Map.cpp.

◆ CalculateCrossedLanes()

std::vector< LaneMarking > carla::road::Map::CalculateCrossedLanes ( const geom::Location origin,
const geom::Location destination 
) const

Definition at line 440 of file road/Map.cpp.

References carla::road::element::LaneCrossingCalculator::Calculate().

Referenced by carla::client::Map::CalculateCrossedLanes(), and GetGeoReference().

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

◆ ComputeJunctionConflicts()

std::unordered_map< road::RoadId, std::unordered_set< road::RoadId > > carla::road::Map::ComputeJunctionConflicts ( JuncId  id) const

Definition at line 739 of file road/Map.cpp.

References carla::geom::BoundingBox::extent, carla::road::Junction::GetBoundingBox(), and carla::geom::BoundingBox::location.

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

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

◆ ComputeTransform()

geom::Transform carla::road::Map::ComputeTransform ( Waypoint  waypoint) const

Definition at line 264 of file road/Map.cpp.

References carla::road::element::Waypoint::s.

Referenced by carla::road::element::LaneCrossingCalculator::Calculate(), carla::road::MapBuilder::CheckSignalsOnRoads(), carla::road::MapBuilder::CreateJunctionBoundingBoxes(), and GetGeoReference().

+ Here is the caller graph for this function:

◆ CreateRtree()

void carla::road::Map::CreateRtree ( )
private

Definition at line 862 of file road/Map.cpp.

References carla::road::Lane::Any, carla::road::ForEachLane(), carla::geom::Transform::GetForwardVector(), carla::road::GetRemainingLength(), carla::geom::Math::GetVectorAngle(), carla::road::Lane::IsStraight(), and RELEASE_ASSERT.

Referenced by Map().

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

◆ GenerateChunkedMesh()

std::vector< std::unique_ptr< geom::Mesh > > carla::road::Map::GenerateChunkedMesh ( const rpc::OpendriveGenerationParameters params) const

◆ GenerateMesh()

geom::Mesh carla::road::Map::GenerateMesh ( const double  distance,
const float  extra_width = 0.6f,
const bool  smooth_junctions = true 
) const

Buids a mesh based on the OpenDRIVE.

Definition at line 980 of file road/Map.cpp.

References carla::geom::MeshFactory::RoadParameters::extra_lane_width, carla::geom::MeshFactory::Generate(), carla::geom::MeshFactory::MergeAndSmooth(), RELEASE_ASSERT, carla::geom::MeshFactory::RoadParameters::resolution, and carla::geom::MeshFactory::road_param.

+ Here is the call graph for this function:

◆ GenerateTopology()

std::vector< std::pair< Waypoint, Waypoint > > carla::road::Map::GenerateTopology ( ) const

Generate the minimum set of waypoints that define the topology of map.

The waypoints are placed at the entrance of each lane.

Definition at line 709 of file road/Map.cpp.

References carla::road::ForEachDrivableLane().

Referenced by carla::client::Map::GetTopology().

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

◆ GenerateWalls()

geom::Mesh carla::road::Map::GenerateWalls ( const double  distance,
const float  wall_height 
) const

◆ GenerateWaypoints()

std::vector< Waypoint > carla::road::Map::GenerateWaypoints ( double  approx_distance) const

Generate all the waypoints in map separated by approx_distance.

Definition at line 633 of file road/Map.cpp.

References carla::road::EPSILON, carla::road::ForEachDrivableLaneAt(), and RELEASE_ASSERT.

Referenced by carla::client::Map::GenerateWaypoints().

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

◆ GenerateWaypointsInRoad()

std::vector< Waypoint > carla::road::Map::GenerateWaypointsInRoad ( RoadId  road_id,
Lane::LaneType  lane_type = Lane::LaneType::Driving 
) const

Generate waypoints at the entry of each lane of the specified road.

Definition at line 677 of file road/Map.cpp.

◆ GenerateWaypointsOnRoadEntries()

std::vector< Waypoint > carla::road::Map::GenerateWaypointsOnRoadEntries ( Lane::LaneType  lane_type = Lane::LaneType::Driving) const

Generate waypoints on each lane at the start of each road.

Definition at line 647 of file road/Map.cpp.

◆ GetAllCrosswalkMesh()

geom::Mesh carla::road::Map::GetAllCrosswalkMesh ( ) const

Buids a mesh of all crosswalks based on the OpenDRIVE.

Definition at line 1111 of file road/Map.cpp.

References carla::geom::Mesh::AddMaterial(), carla::geom::Mesh::AddTriangleFan(), and carla::geom::Mesh::EndMaterial().

+ Here is the call graph for this function:

◆ GetAllCrosswalkZones()

std::vector< geom::Location > carla::road::Map::GetAllCrosswalkZones ( ) const

Returns a list of locations defining 2d areas, when a location is repeated an area is finished.

Definition at line 446 of file road/Map.cpp.

References carla::road::element::Waypoint::lane_id, carla::geom::Transform::location, carla::road::element::Waypoint::road_id, carla::geom::Transform::rotation, carla::road::element::Waypoint::s, carla::road::element::Waypoint::section_id, carla::geom::Transform::TransformPoint(), carla::geom::Vector3D::x, and carla::geom::Rotation::yaw.

Referenced by carla::client::Map::GetAllCrosswalkZones(), and GetGeoReference().

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

◆ GetAllSignalReferences()

std::vector< const element::RoadInfoSignal * > carla::road::Map::GetAllSignalReferences ( ) const

Return all RoadInfoSignal in the map.

Definition at line 428 of file road/Map.cpp.

Referenced by carla::client::Map::GetAllLandmarks(), carla::client::Map::GetAllLandmarksOfType(), and carla::client::Map::GetLandmarksFromId().

+ Here is the caller graph for this function:

◆ GetClosestWaypointOnRoad()

boost::optional< Waypoint > carla::road::Map::GetClosestWaypointOnRoad ( const geom::Location location,
int32_t  lane_type = static_cast<int32_t>(Lane::LaneType::Driving) 
) const

========================================================================

– Geometry ---------------------------------------------------------—

Definition at line 156 of file road/Map.cpp.

References carla::geom::Math::DistanceSegmentToPoint(), carla::road::element::Waypoint::lane_id, carla::road::element::Waypoint::s, carla::geom::Vector3D::x, carla::geom::Vector3D::y, and carla::geom::Vector3D::z.

Referenced by carla::road::element::LaneCrossingCalculator::Calculate(), carla::road::MapBuilder::CheckSignalsOnRoads(), GetGeoReference(), and carla::client::Map::GetWaypoint().

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

◆ GetControllers()

const std::unordered_map<ContId, std::unique_ptr<Controller> >& carla::road::Map::GetControllers ( ) const
inline

Definition at line 171 of file road/Map.h.

References _data, and carla::road::MapData::GetControllers().

Referenced by carla::client::Map::GetLandmarkGroup().

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

◆ GetGeoReference()

const geom::GeoLocation& carla::road::Map::GetGeoReference ( ) const
inline

========================================================================

– Georeference -----------------------------------------------------—

Definition at line 44 of file road/Map.h.

References _data, CalculateCrossedLanes(), ComputeTransform(), carla::road::Lane::Driving, GetAllCrosswalkZones(), GetClosestWaypointOnRoad(), carla::road::MapData::GetGeoReference(), GetJunctionId(), GetLane(), GetLaneType(), GetLaneWidth(), GetMarkRecord(), GetWaypoint(), and IsJunction().

Referenced by carla::client::Map::GetGeoReference().

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

◆ GetJunction() [1/2]

Junction * carla::road::Map::GetJunction ( JuncId  id)

Definition at line 972 of file road/Map.cpp.

Referenced by carla::road::MapBuilder::CreateJunctionBoundingBoxes(), and carla::client::Map::GetJunction().

+ Here is the caller graph for this function:

◆ GetJunction() [2/2]

const Junction * carla::road::Map::GetJunction ( JuncId  id) const

Definition at line 976 of file road/Map.cpp.

◆ GetJunctionId()

JuncId carla::road::Map::GetJunctionId ( RoadId  road_id) const

Definition at line 289 of file road/Map.cpp.

Referenced by GetGeoReference().

+ Here is the caller graph for this function:

◆ GetJunctionWaypoints()

std::vector< std::pair< Waypoint, Waypoint > > carla::road::Map::GetJunctionWaypoints ( JuncId  id,
Lane::LaneType  lane_type 
) const

Generate waypoints of the junction.

Definition at line 722 of file road/Map.cpp.

References carla::road::ForEachLane(), carla::road::Junction::GetConnections(), carla::road::GetDistanceAtEndOfLane(), and carla::road::element::Waypoint::s.

Referenced by carla::road::MapBuilder::CreateJunctionBoundingBoxes(), and carla::client::Map::GetJunctionWaypoints().

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

◆ GetLane()

const Lane & carla::road::Map::GetLane ( Waypoint  waypoint) const

========================================================================

Road information -------------------------------------------------—

Definition at line 809 of file road/Map.cpp.

References carla::road::Road::GetLaneById(), carla::road::Lane::GetRoad(), carla::road::element::Waypoint::lane_id, carla::road::element::Waypoint::road_id, and carla::road::element::Waypoint::section_id.

Referenced by GetGeoReference().

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

◆ GetLaneType()

Lane::LaneType carla::road::Map::GetLaneType ( Waypoint  waypoint) const

Definition at line 272 of file road/Map.cpp.

Referenced by GetGeoReference().

+ Here is the caller graph for this function:

◆ GetLaneWidth()

double carla::road::Map::GetLaneWidth ( Waypoint  waypoint) const

Definition at line 276 of file road/Map.cpp.

References RELEASE_ASSERT, and carla::road::element::Waypoint::s.

Referenced by carla::road::MapBuilder::CheckSignalsOnRoads(), and GetGeoReference().

+ Here is the caller graph for this function:

◆ GetLeft()

boost::optional< Waypoint > carla::road::Map::GetLeft ( Waypoint  waypoint) const

Return a waypoint at the lane of waypoint's left lane.

Definition at line 621 of file road/Map.cpp.

References carla::road::IsLanePresent(), carla::road::element::Waypoint::lane_id, and RELEASE_ASSERT.

+ Here is the call graph for this function:

◆ GetMarkRecord()

std::pair< const RoadInfoMarkRecord *, const RoadInfoMarkRecord * > carla::road::Map::GetMarkRecord ( Waypoint  waypoint) const

Definition at line 298 of file road/Map.cpp.

References carla::road::element::Waypoint::lane_id, RELEASE_ASSERT, carla::road::element::Waypoint::s, and carla::road::element::Waypoint::section_id.

Referenced by carla::road::element::CrossingAtSameSection(), and GetGeoReference().

+ Here is the caller graph for this function:

◆ GetNext()

std::vector< Waypoint > carla::road::Map::GetNext ( Waypoint  waypoint,
double  distance 
) const

Return the list of waypoints at distance such that a vehicle at waypoint could drive to.

Definition at line 545 of file road/Map.cpp.

References carla::road::ConcatVectors(), DEBUG_ASSERT, carla::road::EPSILON, carla::road::element::Waypoint::lane_id, RELEASE_ASSERT, carla::road::element::Waypoint::road_id, carla::road::element::Waypoint::s, and carla::road::element::Waypoint::section_id.

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

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

◆ GetPredecessors()

std::vector< Waypoint > carla::road::Map::GetPredecessors ( Waypoint  waypoint) const

Definition at line 527 of file road/Map.cpp.

References carla::road::GetDistanceAtEndOfLane(), and RELEASE_ASSERT.

+ Here is the call graph for this function:

◆ GetPrevious()

std::vector< Waypoint > carla::road::Map::GetPrevious ( Waypoint  waypoint,
double  distance 
) const

Return the list of waypoints at distance in the reversed direction that a vehicle at waypoint could drive to.

Definition at line 578 of file road/Map.cpp.

References carla::road::ConcatVectors(), DEBUG_ASSERT, carla::road::EPSILON, carla::road::element::Waypoint::lane_id, RELEASE_ASSERT, carla::road::element::Waypoint::road_id, carla::road::element::Waypoint::s, and carla::road::element::Waypoint::section_id.

+ Here is the call graph for this function:

◆ GetRight()

boost::optional< Waypoint > carla::road::Map::GetRight ( Waypoint  waypoint) const

Return a waypoint at the lane of waypoint's right lane.

Definition at line 611 of file road/Map.cpp.

References carla::road::IsLanePresent(), carla::road::element::Waypoint::lane_id, and RELEASE_ASSERT.

+ Here is the call graph for this function:

◆ GetSignals()

const std::unordered_map<SignId, std::unique_ptr<Signal> >& carla::road::Map::GetSignals ( ) const
inline

Definition at line 167 of file road/Map.h.

References _data, and carla::road::MapData::GetSignals().

Referenced by carla::client::Map::GetLandmarkGroup().

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

◆ GetSignalsInDistance()

std::vector< Map::SignalSearchData > carla::road::Map::GetSignalsInDistance ( Waypoint  waypoint,
double  distance,
bool  stop_at_junction = false 
) const

Searches signals from an initial waypoint until the defined distance.

Definition at line 321 of file road/Map.cpp.

References carla::road::ConcatVectors(), DEBUG_ASSERT, carla::road::element::RoadInfo::GetDistance(), carla::road::element::Waypoint::lane_id, carla::road::element::Waypoint::road_id, and carla::road::element::Waypoint::s.

+ Here is the call graph for this function:

◆ GetSuccessors()

std::vector< Waypoint > carla::road::Map::GetSuccessors ( Waypoint  waypoint) const

========================================================================

– Waypoint generation -------------------------------------------——

Return the list of waypoints placed at the entrance of each drivable successor lane; i.e., the list of each waypoint in the next road segment that a vehicle could drive from waypoint.

Definition at line 509 of file road/Map.cpp.

References carla::road::GetDistanceAtStartOfLane(), and RELEASE_ASSERT.

+ Here is the call graph for this function:

◆ GetWaypoint() [1/2]

boost::optional< Waypoint > carla::road::Map::GetWaypoint ( const geom::Location location,
int32_t  lane_type = static_cast<int32_t>(Lane::LaneType::Driving) 
) const

Definition at line 203 of file road/Map.cpp.

References carla::geom::Math::Distance2D(), carla::geom::CubicPolynomial::Evaluate(), and carla::road::element::RoadInfoLaneWidth::GetPolynomial().

Referenced by GetGeoReference(), carla::client::Map::GetWaypoint(), carla::client::Map::GetWaypointXODR(), and carla::road::element::IsOffRoad().

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

◆ GetWaypoint() [2/2]

boost::optional< Waypoint > carla::road::Map::GetWaypoint ( RoadId  road_id,
LaneId  lane_id,
float  s 
) const

Definition at line 224 of file road/Map.cpp.

References carla::road::Road::GetLaneSectionsAt(), carla::road::Road::GetLength(), carla::road::element::Waypoint::lane_id, carla::road::element::Waypoint::road_id, carla::road::element::Waypoint::s, and carla::road::element::Waypoint::section_id.

+ Here is the call graph for this function:

◆ IsJunction()

bool carla::road::Map::IsJunction ( RoadId  road_id) const

Definition at line 293 of file road/Map.cpp.

Referenced by carla::road::element::LaneCrossingCalculator::Calculate(), and GetGeoReference().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _data

MapData carla::road::Map::_data
private

◆ _rtree

Rtree carla::road::Map::_rtree
private

Definition at line 187 of file road/Map.h.

◆ MapBuilder

friend carla::road::Map::MapBuilder
private

Definition at line 183 of file road/Map.h.


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