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

This class builds a discretized local map-cache. More...

#include <InMemoryMap.h>

+ Collaboration diagram for carla::traffic_manager::InMemoryMap:

Public Member Functions

NodeList GetDenseTopology () const
 This method returns the full list of discrete samples of the map in the local cache. More...
 
const cc::MapGetMap () const
 
std::string GetMapName ()
 
SimpleWaypointPtr GetWaypoint (const cg::Location loc) const
 This method returns the closest waypoint to a given location on the map. More...
 
NodeList GetWaypointsInDelta (const cg::Location loc, const uint16_t n_points, const float random_sample) const
 This method returns n waypoints in an delta area with a certain distance from the ego vehicle. More...
 
 InMemoryMap (WorldMap world_map)
 
bool Load (const std::vector< uint8_t > &content)
 
void SetUp ()
 This method constructs the local map with a resolution of sampling_resolution. More...
 
 ~InMemoryMap ()
 

Static Public Member Functions

static void Cook (WorldMap world_map, const std::string &path)
 

Private Member Functions

void FindAndLinkLaneChange (SimpleWaypointPtr reference_waypoint)
 This method is used to find and place lane change links. More...
 
NodeList GetPredecessors (const SegmentId segment_id, const SegmentTopology &segment_topology, const SegmentMap &segment_map)
 
SegmentId GetSegmentId (const WaypointPtr &wp) const
 Computes the segment id of a given waypoint. More...
 
SegmentId GetSegmentId (const SimpleWaypointPtr &swp) const
 
NodeList GetSuccessors (const SegmentId segment_id, const SegmentTopology &segment_topology, const SegmentMap &segment_map)
 
void Save (const std::string &path)
 
void SetUpDenseTopology ()
 
void SetUpRoadOption ()
 
void SetUpSpatialTree ()
 

Private Attributes

WorldMap _world_map
 Object to hold the world map received by the constructor. More...
 
NodeList dense_topology
 Structure to hold all custom waypoint objects after interpolation of sparse topology. More...
 
Rtree rtree
 Spatial quadratic R-tree for indexing and querying waypoints. More...
 

Detailed Description

This class builds a discretized local map-cache.

Instantiate the class with the world and run SetUp() to construct the local map.

Definition at line 63 of file InMemoryMap.h.

Constructor & Destructor Documentation

◆ InMemoryMap()

carla::traffic_manager::InMemoryMap::InMemoryMap ( WorldMap  world_map)

Definition at line 22 of file InMemoryMap.cpp.

◆ ~InMemoryMap()

carla::traffic_manager::InMemoryMap::~InMemoryMap ( )

Definition at line 23 of file InMemoryMap.cpp.

Member Function Documentation

◆ Cook()

void carla::traffic_manager::InMemoryMap::Cook ( WorldMap  world_map,
const std::string &  path 
)
static

Definition at line 71 of file InMemoryMap.cpp.

References Save(), and SetUp().

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

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

◆ FindAndLinkLaneChange()

void carla::traffic_manager::InMemoryMap::FindAndLinkLaneChange ( SimpleWaypointPtr  reference_waypoint)
private

This method is used to find and place lane change links.

Cheack for transits

Left transit way point present only

Right transit way point present only

Both left and right transit present

Right transit way point

Left transit way point

For no transit waypoint (left or right)

Definition at line 512 of file InMemoryMap.cpp.

References carla::road::Both, and GetWaypoint().

Referenced by SetUp().

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

◆ GetDenseTopology()

NodeList carla::traffic_manager::InMemoryMap::GetDenseTopology ( ) const

This method returns the full list of discrete samples of the map in the local cache.

Definition at line 508 of file InMemoryMap.cpp.

References dense_topology.

◆ GetMap()

const cc::Map & carla::traffic_manager::InMemoryMap::GetMap ( ) const

Definition at line 583 of file InMemoryMap.cpp.

References _world_map.

◆ GetMapName()

std::string carla::traffic_manager::InMemoryMap::GetMapName ( )

Definition at line 578 of file InMemoryMap.cpp.

References _world_map.

Referenced by Save().

+ Here is the caller graph for this function:

◆ GetPredecessors()

NodeList carla::traffic_manager::InMemoryMap::GetPredecessors ( const SegmentId  segment_id,
const SegmentTopology segment_topology,
const SegmentMap segment_map 
)
private

Definition at line 52 of file InMemoryMap.cpp.

Referenced by SetUp().

+ Here is the caller graph for this function:

◆ GetSegmentId() [1/2]

SegmentId carla::traffic_manager::InMemoryMap::GetSegmentId ( const WaypointPtr wp) const
private

Computes the segment id of a given waypoint.

The Id takes into account OpenDrive's road Id, lane Id and Section Id.

Definition at line 25 of file InMemoryMap.cpp.

Referenced by GetSegmentId(), and SetUp().

+ Here is the caller graph for this function:

◆ GetSegmentId() [2/2]

SegmentId carla::traffic_manager::InMemoryMap::GetSegmentId ( const SimpleWaypointPtr swp) const
private

Definition at line 29 of file InMemoryMap.cpp.

References GetSegmentId().

+ Here is the call graph for this function:

◆ GetSuccessors()

NodeList carla::traffic_manager::InMemoryMap::GetSuccessors ( const SegmentId  segment_id,
const SegmentTopology segment_topology,
const SegmentMap segment_map 
)
private

Definition at line 33 of file InMemoryMap.cpp.

Referenced by SetUp().

+ Here is the caller graph for this function:

◆ GetWaypoint()

SimpleWaypointPtr carla::traffic_manager::InMemoryMap::GetWaypoint ( const cg::Location  loc) const

This method returns the closest waypoint to a given location on the map.

Definition at line 467 of file InMemoryMap.cpp.

References rtree, carla::geom::Vector3D::x, carla::geom::Vector3D::y, and carla::geom::Vector3D::z.

Referenced by FindAndLinkLaneChange().

+ Here is the caller graph for this function:

◆ GetWaypointsInDelta()

NodeList carla::traffic_manager::InMemoryMap::GetWaypointsInDelta ( const cg::Location  loc,
const uint16_t  n_points,
const float  random_sample 
) const

This method returns n waypoints in an delta area with a certain distance from the ego vehicle.

Definition at line 480 of file InMemoryMap.cpp.

References carla::traffic_manager::constants::Map::DELTA, rtree, carla::geom::Vector3D::x, carla::geom::Vector3D::y, carla::geom::Vector3D::z, and carla::traffic_manager::constants::Map::Z_DELTA.

◆ Load()

bool carla::traffic_manager::InMemoryMap::Load ( const std::vector< uint8_t > &  content)

◆ Save()

void carla::traffic_manager::InMemoryMap::Save ( const std::string &  path)
private

Definition at line 77 of file InMemoryMap.cpp.

References dense_topology, GetMapName(), carla::log_error(), and carla::traffic_manager::CachedSimpleWaypoint::Write().

Referenced by Cook().

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

◆ SetUp()

void carla::traffic_manager::InMemoryMap::SetUp ( )

This method constructs the local map with a resolution of sampling_resolution.

Definition at line 166 of file InMemoryMap.cpp.

References _world_map, dense_topology, carla::geom::Math::DistanceSquared(), FindAndLinkLaneChange(), GetPredecessors(), GetSegmentId(), GetSuccessors(), carla::geom::Math::GetVectorAngle(), carla::traffic_manager::constants::Map::MAP_RESOLUTION, carla::traffic_manager::constants::Map::MAX_GEODESIC_GRID_LENGTH, carla::traffic_manager::constants::LaneChange::MAX_WPT_DISTANCE, carla::traffic_manager::constants::Map::MAX_WPT_RADIANS, carla::traffic_manager::constants::Map::MIN_LANE_WIDTH, reverse(), SetUpRoadOption(), SetUpSpatialTree(), and sort().

Referenced by Cook().

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

◆ SetUpDenseTopology()

void carla::traffic_manager::InMemoryMap::SetUpDenseTopology ( )
private

◆ SetUpRoadOption()

void carla::traffic_manager::InMemoryMap::SetUpRoadOption ( )
private

Definition at line 378 of file InMemoryMap.cpp.

References dense_topology, carla::traffic_manager::LaneFollow, carla::traffic_manager::Left, carla::traffic_manager::Right, carla::traffic_manager::RoadEnd, carla::traffic_manager::Straight, carla::traffic_manager::constants::Map::STRAIGHT_DEG, and carla::traffic_manager::Void.

Referenced by SetUp().

+ Here is the caller graph for this function:

◆ SetUpSpatialTree()

void carla::traffic_manager::InMemoryMap::SetUpSpatialTree ( )
private

Definition at line 368 of file InMemoryMap.cpp.

References dense_topology, rtree, carla::geom::Vector3D::x, carla::geom::Vector3D::y, and carla::geom::Vector3D::z.

Referenced by Load(), and SetUp().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _world_map

WorldMap carla::traffic_manager::InMemoryMap::_world_map
private

Object to hold the world map received by the constructor.

Definition at line 68 of file InMemoryMap.h.

Referenced by GetMap(), GetMapName(), Load(), and SetUp().

◆ dense_topology

NodeList carla::traffic_manager::InMemoryMap::dense_topology
private

Structure to hold all custom waypoint objects after interpolation of sparse topology.

Definition at line 71 of file InMemoryMap.h.

Referenced by GetDenseTopology(), Load(), Save(), SetUp(), SetUpRoadOption(), and SetUpSpatialTree().

◆ rtree

Rtree carla::traffic_manager::InMemoryMap::rtree
private

Spatial quadratic R-tree for indexing and querying waypoints.

Definition at line 73 of file InMemoryMap.h.

Referenced by GetWaypoint(), GetWaypointsInDelta(), and SetUpSpatialTree().


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