19#include <rclcpp/rclcpp.hpp>
20#include <boost/uuid/uuid.hpp>
21#include <boost/uuid/uuid_io.hpp>
22#include <boost/uuid/uuid_generators.hpp>
23#include <lanelet2_core/LaneletMap.h>
24#include <lanelet2_core/primitives/Point.h>
25#include <lanelet2_extension/regulatory_elements/StopRule.h>
26#include <lanelet2_extension/regulatory_elements/CarmaTrafficSignal.h>
27#include <lanelet2_core/primitives/LaneletOrArea.h>
28#include <lanelet2_extension/projection/local_frame_projector.h>
30#include <carma_v2x_msgs/msg/map_data.hpp>
31#include <lanelet2_core/Forward.h>
32#include <lanelet2_extension/regulatory_elements/SignalizedIntersection.h>
33#include <lanelet2_core/geometry/LaneletMap.h>
34#include <carma_ros2_utils/carma_lifecycle_node.hpp>
46using namespace lanelet::units::literals;
92 void createIntersectionFromMapMsg(std::vector<lanelet::SignalizedIntersectionPtr>& intersections, std::vector<lanelet::CarmaTrafficSignalPtr>& traffic_signals,
const carma_v2x_msgs::msg::MapData& map_msg,
93 const std::shared_ptr<lanelet::LaneletMap>& map, std::shared_ptr<const lanelet::routing::RoutingGraph> routing_graph);
106 void convertLaneToLaneletId(std::unordered_map<uint8_t, lanelet::Id>& entry, std::unordered_map<uint8_t, lanelet::Id>& exit,
const carma_v2x_msgs::msg::IntersectionGeometry& intersection,
107 const std::shared_ptr<lanelet::LaneletMap>& map, std::shared_ptr<const lanelet::routing::RoutingGraph> current_routing_graph);
136 std::shared_ptr<lanelet::CarmaTrafficSignal>
createTrafficSignalUsingSGID(uint8_t signal_group_id,
const lanelet::Lanelets& entry_lanelets,
const lanelet::Lanelets& exit_lanelets);
145 lanelet::Lanelets
identifyInteriorLanelets(
const lanelet::Lanelets& entry_llts,
const std::shared_ptr<lanelet::LaneletMap>& map);
163 std::unordered_map<uint16_t, std::unordered_map<uint8_t,std::vector<std::pair<boost::posix_time::ptime, lanelet::CarmaTrafficSignalState>>>>
traffic_signal_states_;
169 std::unordered_map<uint16_t, std::unordered_map<uint8_t,std::pair<boost::posix_time::ptime, lanelet::CarmaTrafficSignalState>>>
last_seen_state_;
This class manages and keeps track of all signalized intersections in the map. All of the SPAT and MA...
lanelet::Lanelets identifyInteriorLanelets(const lanelet::Lanelets &entry_llts, const std::shared_ptr< lanelet::LaneletMap > &map)
Returns carma traffic signal and saves all id relevant id mappings (signal group to lanelet id) inter...
lanelet::Id matchSignalizedIntersection(const lanelet::Lanelets &entry_llts, const lanelet::Lanelets &exit_llts)
Returns existing signalized intersection with same entry and exit llts if exists.
std::unordered_map< uint16_t, std::pair< double, double > > intersection_coord_correction_
void setTargetFrame(const std::string &target_frame)
Saves the georeference string to be used for converting MAP.msg coordinates.
std::unordered_map< uint16_t, std::unordered_map< uint8_t, std::pair< boost::posix_time::ptime, lanelet::CarmaTrafficSignalState > > > last_seen_state_
std::unordered_map< uint8_t, std::unordered_set< lanelet::Id > > signal_group_to_entry_lanelet_ids_
std::string target_frame_
std::unordered_map< uint16_t, lanelet::Id > intersection_id_to_regem_id_
std::unordered_map< uint16_t, std::unordered_map< uint8_t, std::vector< boost::posix_time::ptime > > > traffic_signal_start_times_
std::shared_ptr< lanelet::CarmaTrafficSignal > createTrafficSignalUsingSGID(uint8_t signal_group_id, const lanelet::Lanelets &entry_lanelets, const lanelet::Lanelets &exit_lanelets)
Returns carma traffic signal and saves all id relevant id mappings (signal group to lanelet id) inter...
SignalizedIntersectionManager & operator=(SignalizedIntersectionManager other)
Assignment operator that copies everything except the traffic signal states. This is to keep the stat...
bool operator==(const SignalizedIntersectionManager &rhs)
Equality operator that checks if every mapping are same except the traffic signal states....
std::unordered_map< uint8_t, std::unordered_set< lanelet::Id > > signal_group_to_exit_lanelet_ids_
std::unordered_map< uint16_t, std::unordered_map< uint8_t, std::vector< std::pair< boost::posix_time::ptime, lanelet::CarmaTrafficSignalState > > > > traffic_signal_states_
std::unordered_map< uint16_t, std::unordered_map< uint8_t, int > > signal_state_counter_
std::unordered_map< uint8_t, lanelet::Id > signal_group_to_traffic_light_id_
void convertLaneToLaneletId(std::unordered_map< uint8_t, lanelet::Id > &entry, std::unordered_map< uint8_t, lanelet::Id > &exit, const carma_v2x_msgs::msg::IntersectionGeometry &intersection, const std::shared_ptr< lanelet::LaneletMap > &map, std::shared_ptr< const lanelet::routing::RoutingGraph > current_routing_graph)
Returns mapping of MAP lane id to lanelet id for the given map and intersection.msg in the MAP....
void setMaxLaneWidth(double max_lane_width)
Sets the max lane width in meters. Map msg points are associated to a lanelet if they are within this...
void createIntersectionFromMapMsg(std::vector< lanelet::SignalizedIntersectionPtr > &intersections, std::vector< lanelet::CarmaTrafficSignalPtr > &traffic_signals, const carma_v2x_msgs::msg::MapData &map_msg, const std::shared_ptr< lanelet::LaneletMap > &map, std::shared_ptr< const lanelet::routing::RoutingGraph > routing_graph)
Create relevant signalized intersection and carma traffic signals based on the MAP....
SignalizedIntersectionManager()
static const uint8_t INGRESS
static const uint8_t EGRESS