CARLA
Loading...
Searching...
No Matches
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:

Classes

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

Public Types

using Waypoint = element::Waypoint
 

Public Member Functions

std::vector< element::LaneMarking > CalculateCrossedLanes (const geom::Location &origin, const geom::Location &destination) const
 
std::unordered_map< road::RoadId, std::unordered_set< road::RoadId > > ComputeJunctionConflicts (JuncId id) const
 
std::unordered_set< road::RoadId > ComputeSkippedGenerationRoads () const
 Roads excluded from mesh/marking generation: link-less sub-2m slivers and link-less duplicate traces overlapping a connected road (DeepMap/NuRec export artifacts that render as floating slabs of road stacked on the real carriageway).
 
geom::Transform ComputeTransform (Waypoint waypoint) const
 
std::vector< JuncId > FilterJunctionsByPosition (const geom::Vector3D &minpos, const geom::Vector3D &maxpos) const
 
std::vector< RoadId > FilterRoadsByPosition (const geom::Vector3D &minpos, const geom::Vector3D &maxpos) const
 
std::vector< std::unique_ptr< geom::Mesh > > GenerateChunkedMesh (const rpc::OpendriveGenerationParameters &params) const
 
std::unique_ptr< geom::Mesh > GenerateJunctionFill (const road::Junction &junction, const geom::Mesh &corridor_mesh) const
 Paves the regions a junction's lane corridors enclose but don't cover (see GenerateChunkedMesh).
 
void GenerateJunctions (const carla::geom::MeshFactory &mesh_factory, const rpc::OpendriveGenerationParameters &params, const geom::Vector3D &minpos, const geom::Vector3D &maxpos, std::map< road::Lane::LaneType, std::vector< std::unique_ptr< geom::Mesh > > > *juntion_out_mesh_list) const
 
std::vector< std::unique_ptr< geom::Mesh > > GenerateLineMarkings (const rpc::OpendriveGenerationParameters &params, const geom::Vector3D &minpos, const geom::Vector3D &maxpos, std::vector< std::string > &outinfo) const
 Buids a list of meshes related with LineMarkings.
 
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.
 
std::map< road::Lane::LaneType, std::vector< std::unique_ptr< geom::Mesh > > > GenerateOrderedChunkedMeshInLocations (const rpc::OpendriveGenerationParameters &params, const geom::Vector3D &minpos, const geom::Vector3D &maxpos) const
 
std::map< road::Lane::LaneType, std::vector< std::unique_ptr< geom::Mesh > > > GenerateRoadsMultithreaded (const carla::geom::MeshFactory &mesh_factory, const std::vector< RoadId > &RoadsID, const size_t index, const size_t number_of_roads_per_thread) const
 
void GenerateSingleJunction (const carla::geom::MeshFactory &mesh_factory, const JuncId Id, std::map< road::Lane::LaneType, std::vector< std::unique_ptr< geom::Mesh > > > *junction_out_mesh_list) const
 
std::vector< std::pair< Waypoint, Waypoint > > GenerateTopology () const
 Generate the minimum set of waypoints that define the topology of map.
 
geom::Mesh GenerateWalls (const double distance, const float wall_height) const
 
std::vector< Waypoint > GenerateWaypoints (double approx_distance) const
 Generate all the waypoints in map separated by approx_distance.
 
std::vector< Waypoint > GenerateWaypointsInRoad (RoadId road_id, Lane::LaneType lane_type=Lane::LaneType::Driving) const
 Generate waypoints at the entry of each lane of the specified road.
 
std::vector< Waypoint > GenerateWaypointsOnRoadEntries (Lane::LaneType lane_type=Lane::LaneType::Driving) const
 Generate waypoints on each lane at the start of each road.
 
geom::Mesh GetAllCrosswalkMesh () const
 Buids a mesh of all crosswalks based on the OpenDRIVE.
 
std::vector< geom::Location > GetAllCrosswalkZones () const
 Returns a list of locations defining 2d areas, when a location is repeated an area is finished.
 
std::vector< const element::RoadInfoSignal * > GetAllSignalReferences () const
 Return all RoadInfoSignal in the map.
 
std::vector< const element::RoadInfoStencil * > GetAllStencilReferences () const
 Return all RoadInfoStencil in the map.
 
std::optional< element::Waypoint > GetClosestWaypointOnRoad (const geom::Location &location, int32_t lane_type=static_cast< int32_t >(Lane::LaneType::Driving)) const
 ========================================================================
 
const std::unordered_map< ContId, std::unique_ptr< Controller > > & GetControllers () const
 
const MapData & GetData () const
 Read-only access to the parsed OpenDRIVE data: roads, junctions, signals and controllers.
 
const geom::GeoProjection & GetGeoProjection () const
 
const geom::GeoLocation & GetGeoReference () const
 ========================================================================
 
Junction * GetJunction (JuncId id)
 
const Junction * GetJunction (JuncId id) const
 
JuncId GetJunctionId (RoadId road_id) const
 
std::vector< carla::geom::BoundingBox > GetJunctionsBoundingBoxes () const
 
std::vector< std::pair< Waypoint, Waypoint > > GetJunctionWaypoints (JuncId id, Lane::LaneType lane_type) const
 Generate waypoints of the junction.
 
const Lane & GetLane (Waypoint waypoint) const
 ========================================================================
 
Lane::LaneType GetLaneType (Waypoint waypoint) const
 
double GetLaneWidth (Waypoint waypoint) const
 
std::optional< Waypoint > GetLeft (Waypoint waypoint) const
 Return a waypoint at the lane of waypoint's left lane.
 
std::pair< const element::RoadInfoMarkRecord *, const element::RoadInfoMarkRecord * > GetMarkRecord (Waypoint waypoint) const
 
std::vector< Waypoint > GetNext (Waypoint waypoint, double distance) const
 Return the list of waypoints at distance such that a vehicle at waypoint could drive to.
 
std::vector< Waypoint > GetPredecessors (Waypoint waypoint) const
 
std::vector< Waypoint > 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.
 
std::optional< Waypoint > GetRight (Waypoint waypoint) const
 Return a waypoint at the lane of waypoint's right lane.
 
const std::unordered_map< SignId, std::unique_ptr< Signal > > & GetSignals () const
 
std::vector< SignalSearchData > GetSignalsInDistance (Waypoint waypoint, double distance, bool stop_at_junction=false) const
 Searches signals from an initial waypoint until the defined distance.
 
const std::unordered_map< StencilId, std::unique_ptr< Stencil > > & GetStencils () const
 
std::vector< StencilSearchData > GetStencilsInDistance (Waypoint waypoint, double distance, bool stop_at_junction=false) const
 Searches stencils from an initial waypoint until the defined distance.
 
std::vector< Waypoint > GetSuccessors (Waypoint waypoint) const
 ========================================================================
 
std::vector< std::pair< geom::Transform, std::string > > GetTreesTransform (const geom::Vector3D &minpos, const geom::Vector3D &maxpos, float distancebetweentrees, float distancefromdrivinglineborder, float s_offset=0, bool measure_from_curb=false, bool keep_on_sidewalk=false) const
 
std::optional< element::Waypoint > GetWaypoint (const geom::Location &location, int32_t lane_type=static_cast< int32_t >(Lane::LaneType::Driving)) const
 
std::optional< element::Waypoint > GetWaypoint (RoadId road_id, LaneId lane_id, float s) const
 
float GetZPosInDeformation (float posx, float posy) const
 
bool IsJunction (RoadId road_id) const
 
 Map (MapData m)
 ========================================================================
 
std::unique_ptr< geom::Mesh > SDFToMesh (const road::Junction &jinput, const std::vector< geom::Vector3D > &sdfinput, int grid_cells_per_dim) const
 

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

Private Attributes

MapData _data
 
Rtree _rtree
 
friend MapBuilder
 

Detailed Description

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

Member Typedef Documentation

◆ Rtree

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

◆ Waypoint

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

Constructor & Destructor Documentation

◆ Map()

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

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

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

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

References CreateRtree().

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 1004 of file road/Map.cpp.

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

Referenced by AddElementToRtreeAndUpdateTransforms(), and CreateRtree().

◆ 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 1025 of file road/Map.cpp.

References AddElementToRtree(), and ComputeTransform().

Referenced by CreateRtree().

◆ CalculateCrossedLanes()

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

◆ ComputeJunctionConflicts()

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

◆ ComputeSkippedGenerationRoads()

std::unordered_set< RoadId > carla::road::Map::ComputeSkippedGenerationRoads ( ) const

Roads excluded from mesh/marking generation: link-less sub-2m slivers and link-less duplicate traces overlapping a connected road (DeepMap/NuRec export artifacts that render as floating slabs of road stacked on the real carriageway).

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

References _data, carla::road::ComputeDuplicateTraceRoads(), carla::road::MapData::GetRoads(), carla::road::IsOrphanSliverRoad(), and road.

Referenced by GenerateChunkedMesh(), GenerateLineMarkings(), and GenerateOrderedChunkedMeshInLocations().

◆ ComputeTransform()

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

◆ CreateRtree()

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

◆ FilterJunctionsByPosition()

std::vector< JuncId > carla::road::Map::FilterJunctionsByPosition ( const geom::Vector3D &  minpos,
const geom::Vector3D &  maxpos 
) const

◆ FilterRoadsByPosition()

std::vector< RoadId > carla::road::Map::FilterRoadsByPosition ( const geom::Vector3D &  minpos,
const geom::Vector3D &  maxpos 
) const

◆ GenerateChunkedMesh()

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

◆ GenerateJunctionFill()

std::unique_ptr< geom::Mesh > carla::road::Map::GenerateJunctionFill ( const road::Junction &  junction,
const geom::Mesh &  corridor_mesh 
) const

◆ GenerateJunctions()

void carla::road::Map::GenerateJunctions ( const carla::geom::MeshFactory &  mesh_factory,
const rpc::OpendriveGenerationParameters &  params,
const geom::Vector3D &  minpos,
const geom::Vector3D &  maxpos,
std::map< road::Lane::LaneType, std::vector< std::unique_ptr< geom::Mesh > > > *  juntion_out_mesh_list 
) const

◆ GenerateLineMarkings()

std::vector< std::unique_ptr< geom::Mesh > > carla::road::Map::GenerateLineMarkings ( const rpc::OpendriveGenerationParameters &  params,
const geom::Vector3D &  minpos,
const geom::Vector3D &  maxpos,
std::vector< std::string > &  outinfo 
) const

◆ GenerateMesh()

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

◆ GenerateOrderedChunkedMeshInLocations()

std::map< road::Lane::LaneType, std::vector< std::unique_ptr< geom::Mesh > > > carla::road::Map::GenerateOrderedChunkedMeshInLocations ( const rpc::OpendriveGenerationParameters &  params,
const geom::Vector3D &  minpos,
const geom::Vector3D &  maxpos 
) const

◆ GenerateRoadsMultithreaded()

std::map< road::Lane::LaneType, std::vector< std::unique_ptr< geom::Mesh > > > carla::road::Map::GenerateRoadsMultithreaded ( const carla::geom::MeshFactory &  mesh_factory,
const std::vector< RoadId > &  RoadsID,
const size_t  index,
const size_t  number_of_roads_per_thread 
) const

◆ GenerateSingleJunction()

void carla::road::Map::GenerateSingleJunction ( const carla::geom::MeshFactory &  mesh_factory,
const JuncId  Id,
std::map< road::Lane::LaneType, std::vector< std::unique_ptr< geom::Mesh > > > *  junction_out_mesh_list 
) const

◆ 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 884 of file road/Map.cpp.

References _data, distance, carla::road::ForEachDrivableLane(), carla::road::GetDistanceAtEndOfLane(), GetLane(), carla::road::MapData::GetRoads(), GetSuccessors(), GetWaypoint(), and road.

◆ 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 811 of file road/Map.cpp.

References _data, distance, carla::road::EPSILON, carla::road::ForEachDrivableLaneAt(), carla::road::MapData::GetRoads(), RELEASE_ASSERT, and road.

Referenced by carla::road::ComputeDuplicateTraceRoads().

◆ 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 854 of file road/Map.cpp.

References _data, carla::road::MapData::GetRoads(), road, and road_id.

◆ 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 825 of file road/Map.cpp.

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

◆ GetAllCrosswalkMesh()

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

◆ GetAllCrosswalkZones()

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

◆ GetAllSignalReferences()

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

Return all RoadInfoSignal in the map.

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

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

◆ GetAllStencilReferences()

std::vector< const element::RoadInfoStencil * > carla::road::Map::GetAllStencilReferences ( ) const

Return all RoadInfoStencil in the map.

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

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

◆ GetClosestWaypointOnRoad()

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

◆ GetControllers()

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

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

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

◆ GetData()

const MapData & carla::road::Map::GetData ( ) const
inline

Read-only access to the parsed OpenDRIVE data: roads, junctions, signals and controllers.

The client-side carla::client::Road, LaneSection and Lane wrappers resolve their ids through this.

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

References _data.

◆ GetGeoProjection()

const geom::GeoProjection & carla::road::Map::GetGeoProjection ( ) const
inline

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

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

◆ GetGeoReference()

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

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

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

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

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

◆ GetJunction() [1/2]

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

◆ GetJunction() [2/2]

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

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

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

◆ GetJunctionId()

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

◆ GetJunctionsBoundingBoxes()

std::vector< carla::geom::BoundingBox > carla::road::Map::GetJunctionsBoundingBoxes ( ) const

◆ GetJunctionWaypoints()

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

◆ GetLane()

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

◆ GetLaneType()

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

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

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

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

◆ GetLaneWidth()

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

◆ GetLeft()

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

◆ GetMarkRecord()

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

◆ GetNext()

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

◆ GetPredecessors()

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

◆ GetPrevious()

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

◆ GetRight()

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

◆ GetSignals()

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

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

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

◆ GetSignalsInDistance()

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

◆ GetStencils()

const std::unordered_map< StencilId, std::unique_ptr< Stencil > > & carla::road::Map::GetStencils ( ) const
inline

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

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

◆ GetStencilsInDistance()

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

◆ 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 617 of file road/Map.cpp.

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

Referenced by GenerateTopology(), GetNext(), GetSignalsInDistance(), and GetStencilsInDistance().

◆ GetTreesTransform()

std::vector< std::pair< geom::Transform, std::string > > carla::road::Map::GetTreesTransform ( const geom::Vector3D &  minpos,
const geom::Vector3D &  maxpos,
float  distancebetweentrees,
float  distancefromdrivinglineborder,
float  s_offset = 0,
bool  measure_from_curb = false,
bool  keep_on_sidewalk = false 
) const

◆ GetWaypoint() [1/2]

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

◆ GetWaypoint() [2/2]

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

◆ GetZPosInDeformation()

float carla::road::Map::GetZPosInDeformation ( float  posx,
float  posy 
) const
inline

◆ IsJunction()

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

◆ SDFToMesh()

std::unique_ptr< geom::Mesh > carla::road::Map::SDFToMesh ( const road::Junction &  jinput,
const std::vector< geom::Vector3D > &  sdfinput,
int  grid_cells_per_dim 
) const

Member Data Documentation

◆ _data

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

◆ _rtree

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

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

Referenced by ComputeJunctionConflicts(), CreateRtree(), and GetClosestWaypointOnRoad().

◆ MapBuilder

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

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


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