11 #include <unordered_map> 12 #include <unordered_set> 14 #if defined(__clang__) 15 # pragma clang diagnostic push 16 # pragma clang diagnostic ignored "-Wshadow" 18 #include "boost/geometry.hpp" 19 #include "boost/geometry/geometries/point.hpp" 20 #include "boost/geometry/index/rtree.hpp" 21 #if defined(__clang__) 22 # pragma clang diagnostic pop 37 namespace traffic_manager {
42 namespace bg = boost::geometry;
43 namespace bgi = boost::geometry::index;
47 using NodeList = std::vector<SimpleWaypointPtr>;
51 using Point3D = bg::model::point<float, 3, bg::cs::cartesian>;
52 using Box = bg::model::box<Point3D>;
55 using SegmentId = std::tuple<crd::RoadId, crd::LaneId, crd::SectionId>;
56 using SegmentTopology = std::map<SegmentId, std::pair<std::vector<SegmentId>, std::vector<SegmentId>>>;
57 using SegmentMap = std::map<SegmentId, std::vector<SimpleWaypointPtr>>;
58 using Rtree = bgi::rtree<SpatialTreeEntry, bgi::rstar<16>>;
80 static void Cook(
WorldMap world_map,
const std::string& path);
83 bool Load(
const std::vector<uint8_t>& content);
102 void Save(
const std::string& path);
SegmentId GetSegmentId(const WaypointPtr &wp) const
Computes the segment id of a given waypoint.
NodeList GetPredecessors(const SegmentId segment_id, const SegmentTopology &segment_topology, const SegmentMap &segment_map)
NodeList GetDenseTopology() const
This method returns the full list of discrete samples of the map in the local cache.
Rtree rtree
Spatial quadratic R-tree for indexing and querying waypoints.
bg::model::point< float, 3, bg::cs::cartesian > Point3D
InMemoryMap(WorldMap world_map)
bgi::rtree< SpatialTreeEntry, bgi::rstar< 16 > > Rtree
SimpleWaypointPtr GetWaypoint(const cg::Location loc) const
This method returns the closest waypoint to a given location on the map.
void SetUpDenseTopology()
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
This file contains definitions of common data structures used in traffic manager. ...
static void Cook(WorldMap world_map, const std::string &path)
NodeList GetSuccessors(const SegmentId segment_id, const SegmentTopology &segment_topology, const SegmentMap &segment_map)
void FindAndLinkLaneChange(SimpleWaypointPtr reference_waypoint)
This method is used to find and place lane change links.
bg::model::box< Point3D > Box
void Save(const std::string &path)
std::map< SegmentId, std::vector< SimpleWaypointPtr > > SegmentMap
std::map< SegmentId, std::pair< std::vector< SegmentId >, std::vector< SegmentId > >> SegmentTopology
carla::SharedPtr< cc::Waypoint > WaypointPtr
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...
std::vector< SimpleWaypointPtr > NodeList
bool Load(const std::vector< uint8_t > &content)
std::shared_ptr< SimpleWaypoint > SimpleWaypointPtr
std::pair< Point3D, SimpleWaypointPtr > SpatialTreeEntry
NodeList dense_topology
Structure to hold all custom waypoint objects after interpolation of sparse topology.
const cc::Map & GetMap() const
carla::SharedPtr< const cc::Map > WorldMap
This class builds a discretized local map-cache.
void SetUp()
This method constructs the local map with a resolution of sampling_resolution.
WorldMap _world_map
Object to hold the world map received by the constructor.
std::tuple< crd::RoadId, crd::LaneId, crd::SectionId > SegmentId