CARLA
Loading...
Searching...
No Matches
carla::traffic_manager::InMemoryMap Class Reference

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

#include <InMemoryMap.h>

Public Member Functions

NodeList GetDenseTopology () const
 This method returns the full list of discrete samples of the map in the local cache.
const cc::Map & GetMap () const
std::string GetMapName ()
SimpleWaypointPtr GetWaypoint (const cg::Location loc) const
 This method returns the closest waypoint to a given location on the map.
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.
 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.
 ~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.
NodeList GetPredecessors (const SegmentId segment_id, const SegmentTopology &segment_topology, const SegmentMap &segment_map)
SegmentId GetSegmentId (const SimpleWaypointPtr &swp) const
SegmentId GetSegmentId (const WaypointPtr &wp) const
 Computes the segment id of a given waypoint.
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.
NodeList dense_topology
 Structure to hold all custom waypoint objects after interpolation of sparse topology.
Rtree rtree
 Spatial quadratic R-tree for indexing and querying waypoints.

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 21 of file InMemoryMap.cpp.

References _world_map.

Referenced by Cook().

◆ ~InMemoryMap()

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

Definition at line 22 of file InMemoryMap.cpp.

References dense_topology.

Member Function Documentation

◆ Cook()

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

Definition at line 79 of file InMemoryMap.cpp.

References InMemoryMap(), Save(), and SetUp().

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

◆ 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 580 of file InMemoryMap.cpp.

References GetWaypoint().

Referenced by SetUp(), and SetUpDenseTopology().

◆ 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 576 of file InMemoryMap.cpp.

References dense_topology.

◆ GetMap()

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

Definition at line 651 of file InMemoryMap.cpp.

References _world_map.

◆ GetMapName()

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

Definition at line 646 of file InMemoryMap.cpp.

References _world_map.

Referenced by Save().

◆ GetPredecessors()

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

Definition at line 60 of file InMemoryMap.cpp.

References GetPredecessors().

Referenced by GetPredecessors(), SetUp(), and SetUpDenseTopology().

◆ GetSegmentId() [1/2]

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

Definition at line 37 of file InMemoryMap.cpp.

References GetSegmentId().

◆ GetSegmentId() [2/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 33 of file InMemoryMap.cpp.

Referenced by GetSegmentId(), SetUp(), and SetUpDenseTopology().

◆ GetSuccessors()

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

Definition at line 41 of file InMemoryMap.cpp.

References GetSuccessors().

Referenced by GetSuccessors(), SetUp(), and SetUpDenseTopology().

◆ 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 528 of file InMemoryMap.cpp.

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

Referenced by FindAndLinkLaneChange().

◆ 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 548 of file InMemoryMap.cpp.

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

◆ Load()

◆ Save()

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

Definition at line 85 of file InMemoryMap.cpp.

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

Referenced by Cook().

◆ SetUp()

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

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

Definition at line 216 of file InMemoryMap.cpp.

References _world_map, dense_topology, carla::geom::Math::DistanceSquared(), FindAndLinkLaneChange(), GetPredecessors(), GetSegmentId(), GetSuccessors(), carla::geom::Math::GetVectorAngle(), SetUpRoadOption(), and SetUpSpatialTree().

Referenced by Cook().

◆ SetUpDenseTopology()

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

◆ SetUpRoadOption()

◆ SetUpSpatialTree()

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

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(), InMemoryMap(), 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(), SetUpSpatialTree(), and ~InMemoryMap().

◆ 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: