Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
|
This class manages and keeps track of all signalized intersections in the map. All of the SPAT and MAP standard's lane ids to lanelet id mapping is recorded here. NOTE: This class functions do not update the map given. More...
#include <SignalizedIntersectionManager.hpp>
Public Member Functions | |
SignalizedIntersectionManager () | |
SignalizedIntersectionManager (const SignalizedIntersectionManager &other) | |
Copy constructor that copies everything except the traffic signal states. This is to keep the states although the map is updated or a similar event happened NOTE: The function does not update the map with new elements. More... | |
SignalizedIntersectionManager & | operator= (SignalizedIntersectionManager other) |
Assignment operator that copies everything except the traffic signal states. This is to keep the states although the map is updated or a similar event happened NOTE: The function does not update the map with new elements. More... | |
bool | operator== (const SignalizedIntersectionManager &rhs) |
Equality operator that checks if every mapping are same except the traffic signal states. This is to keep the states although the map is updated or a similar event happened NOTE: The function does not update the map with new elements. More... | |
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.msg and the lanelet_map NOTE: The function does not update the map with new elements. More... | |
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.msg. This function also records signal_group_id_to its own lanelet id, and also signal group to entry and exit lanelets id mappings. More... | |
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 distance to a lanelet as map msg points are guaranteed to apply to a single lane. More... | |
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. More... | |
void | setTargetFrame (const std::string &target_frame) |
Saves the georeference string to be used for converting MAP.msg coordinates. More... | |
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) internally. More... | |
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) internally. More... | |
Public Attributes | |
std::unordered_map< uint16_t, std::pair< double, double > > | intersection_coord_correction_ |
std::unordered_map< uint16_t, lanelet::Id > | intersection_id_to_regem_id_ |
std::unordered_map< uint8_t, lanelet::Id > | signal_group_to_traffic_light_id_ |
std::unordered_map< uint8_t, std::unordered_set< lanelet::Id > > | signal_group_to_exit_lanelet_ids_ |
std::unordered_map< uint8_t, std::unordered_set< lanelet::Id > > | signal_group_to_entry_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, std::vector< boost::posix_time::ptime > > > | traffic_signal_start_times_ |
std::unordered_map< uint16_t, std::unordered_map< uint8_t, std::pair< boost::posix_time::ptime, lanelet::CarmaTrafficSignalState > > > | last_seen_state_ |
std::unordered_map< uint16_t, std::unordered_map< uint8_t, int > > | signal_state_counter_ |
Private Attributes | |
std::string | target_frame_ = "" |
double | max_lane_width_ = 4 |
This class manages and keeps track of all signalized intersections in the map. All of the SPAT and MAP standard's lane ids to lanelet id mapping is recorded here. NOTE: This class functions do not update the map given.
Definition at line 52 of file SignalizedIntersectionManager.hpp.
|
inline |
Definition at line 56 of file SignalizedIntersectionManager.hpp.
carma_wm::SignalizedIntersectionManager::SignalizedIntersectionManager | ( | const SignalizedIntersectionManager & | other | ) |
Copy constructor that copies everything except the traffic signal states. This is to keep the states although the map is updated or a similar event happened NOTE: The function does not update the map with new elements.
[out] | other | manager |
Definition at line 458 of file SignalizedIntersectionManager.cpp.
References intersection_coord_correction_, intersection_id_to_regem_id_, signal_group_to_entry_lanelet_ids_, signal_group_to_exit_lanelet_ids_, and signal_group_to_traffic_light_id_.
void carma_wm::SignalizedIntersectionManager::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.msg. This function also records signal_group_id_to its own lanelet id, and also signal group to entry and exit lanelets id mappings.
[out] | entry | lane id to lanelet id mappings to return |
[out] | exit | lane id to lanelet id mappings to return |
intersection | MAP.msg that consists all static data portion of the intersection | |
map | lanelet_map to check | |
routing_graph | of the lanelet map to accurately detect lanes |
invalid_argument | if given coordinates in the msg doesn't exist in the map TODO: Need to think about error buffer in the future. Map msgs are made from google maps or open streets maps normally so this function might run into some errors from that. |
Definition at line 58 of file SignalizedIntersectionManager.cpp.
References carma_wm::LANE_DIRECTION::EGRESS, carma_wm::query::getAffectedLaneletOrAreas(), process_bag::i, carma_wm::LANE_DIRECTION::INGRESS, intersection_coord_correction_, max_lane_width_, signal_group_to_entry_lanelet_ids_, signal_group_to_exit_lanelet_ids_, target_frame_, and carma_cooperative_perception::to_string().
Referenced by createIntersectionFromMapMsg().
void carma_wm::SignalizedIntersectionManager::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.msg and the lanelet_map NOTE: The function does not update the map with new elements.
[out] | intersections | to return |
[out] | traffic_signals | to return |
map_msg | MAP.msg that consists all static data portion of the intersection | |
map | lanelet_map to check | |
routing_graph | of the lanelet map to accurately detect lanes |
Definition at line 348 of file SignalizedIntersectionManager.cpp.
References convertLaneToLaneletId(), createTrafficSignalUsingSGID(), identifyInteriorLanelets(), intersection_id_to_regem_id_, matchSignalizedIntersection(), signal_group_to_entry_lanelet_ids_, signal_group_to_exit_lanelet_ids_, signal_group_to_traffic_light_id_, and target_frame_.
std::shared_ptr< lanelet::CarmaTrafficSignal > carma_wm::SignalizedIntersectionManager::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) internally.
signal_group_id | of the traffic signal |
exit_llts | of the signal_group |
entry_llts | of the signal_group |
Definition at line 320 of file SignalizedIntersectionManager.cpp.
References signal_group_to_entry_lanelet_ids_, signal_group_to_exit_lanelet_ids_, and signal_group_to_traffic_light_id_.
Referenced by createIntersectionFromMapMsg().
lanelet::Lanelets carma_wm::SignalizedIntersectionManager::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) internally.
signal_group_id | of the traffic signal |
exit_llts | of the signal_group |
entry_llts | of the signal_group |
Definition at line 421 of file SignalizedIntersectionManager.cpp.
Referenced by createIntersectionFromMapMsg().
lanelet::Id carma_wm::SignalizedIntersectionManager::matchSignalizedIntersection | ( | const lanelet::Lanelets & | entry_llts, |
const lanelet::Lanelets & | exit_llts | ||
) |
Returns existing signalized intersection with same entry and exit llts if exists.
entry_llts | of the intersection |
exit_llts | of the intersection |
Definition at line 259 of file SignalizedIntersectionManager.cpp.
Referenced by createIntersectionFromMapMsg().
SignalizedIntersectionManager & carma_wm::SignalizedIntersectionManager::operator= | ( | SignalizedIntersectionManager | other | ) |
Assignment operator that copies everything except the traffic signal states. This is to keep the states although the map is updated or a similar event happened NOTE: The function does not update the map with new elements.
[out] | other | manager |
Definition at line 447 of file SignalizedIntersectionManager.cpp.
References intersection_coord_correction_, intersection_id_to_regem_id_, signal_group_to_entry_lanelet_ids_, signal_group_to_exit_lanelet_ids_, and signal_group_to_traffic_light_id_.
bool carma_wm::SignalizedIntersectionManager::operator== | ( | const SignalizedIntersectionManager & | rhs | ) |
Equality operator that checks if every mapping are same except the traffic signal states. This is to keep the states although the map is updated or a similar event happened NOTE: The function does not update the map with new elements.
[out] | rhs | manager |
Definition at line 35 of file SignalizedIntersectionManager.cpp.
References intersection_id_to_regem_id_, signal_group_to_entry_lanelet_ids_, signal_group_to_exit_lanelet_ids_, and signal_group_to_traffic_light_id_.
void carma_wm::SignalizedIntersectionManager::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 distance to a lanelet as map msg points are guaranteed to apply to a single lane.
Definition at line 30 of file SignalizedIntersectionManager.cpp.
References max_lane_width_.
void carma_wm::SignalizedIntersectionManager::setTargetFrame | ( | const std::string & | target_frame | ) |
Saves the georeference string to be used for converting MAP.msg coordinates.
target_frame | PROJ string of the map |
Definition at line 25 of file SignalizedIntersectionManager.cpp.
References target_frame_.
std::unordered_map<uint16_t, std::pair<double, double> > carma_wm::SignalizedIntersectionManager::intersection_coord_correction_ |
Definition at line 148 of file SignalizedIntersectionManager.hpp.
Referenced by SignalizedIntersectionManager(), convertLaneToLaneletId(), and operator=().
std::unordered_map<uint16_t, lanelet::Id> carma_wm::SignalizedIntersectionManager::intersection_id_to_regem_id_ |
Definition at line 151 of file SignalizedIntersectionManager.hpp.
Referenced by SignalizedIntersectionManager(), createIntersectionFromMapMsg(), carma_wm::CARMAWorldModel::getTrafficSignalId(), boost::serialization::load(), carma_wm::logSignalizedIntersectionManager(), operator=(), operator==(), and boost::serialization::save().
std::unordered_map<uint16_t, std::unordered_map<uint8_t,std::pair<boost::posix_time::ptime, lanelet::CarmaTrafficSignalState> > > carma_wm::SignalizedIntersectionManager::last_seen_state_ |
Definition at line 169 of file SignalizedIntersectionManager.hpp.
|
private |
Definition at line 179 of file SignalizedIntersectionManager.hpp.
Referenced by convertLaneToLaneletId(), and setMaxLaneWidth().
std::unordered_map<uint8_t, std::unordered_set<lanelet::Id> > carma_wm::SignalizedIntersectionManager::signal_group_to_entry_lanelet_ids_ |
Definition at line 160 of file SignalizedIntersectionManager.hpp.
Referenced by SignalizedIntersectionManager(), convertLaneToLaneletId(), createIntersectionFromMapMsg(), createTrafficSignalUsingSGID(), boost::serialization::load(), carma_wm::logSignalizedIntersectionManager(), operator=(), operator==(), and boost::serialization::save().
std::unordered_map<uint8_t, std::unordered_set<lanelet::Id> > carma_wm::SignalizedIntersectionManager::signal_group_to_exit_lanelet_ids_ |
Definition at line 157 of file SignalizedIntersectionManager.hpp.
Referenced by SignalizedIntersectionManager(), convertLaneToLaneletId(), createIntersectionFromMapMsg(), createTrafficSignalUsingSGID(), boost::serialization::load(), carma_wm::logSignalizedIntersectionManager(), operator=(), operator==(), and boost::serialization::save().
std::unordered_map<uint8_t, lanelet::Id> carma_wm::SignalizedIntersectionManager::signal_group_to_traffic_light_id_ |
Definition at line 154 of file SignalizedIntersectionManager.hpp.
Referenced by SignalizedIntersectionManager(), createIntersectionFromMapMsg(), createTrafficSignalUsingSGID(), carma_wm::CARMAWorldModel::getTrafficSignalId(), boost::serialization::load(), carma_wm::logSignalizedIntersectionManager(), operator=(), operator==(), and boost::serialization::save().
std::unordered_map<uint16_t, std::unordered_map<uint8_t,int> > carma_wm::SignalizedIntersectionManager::signal_state_counter_ |
Definition at line 172 of file SignalizedIntersectionManager.hpp.
|
private |
Definition at line 176 of file SignalizedIntersectionManager.hpp.
Referenced by convertLaneToLaneletId(), createIntersectionFromMapMsg(), and setTargetFrame().
std::unordered_map<uint16_t, std::unordered_map<uint8_t,std::vector<boost::posix_time::ptime> > > carma_wm::SignalizedIntersectionManager::traffic_signal_start_times_ |
Definition at line 166 of file SignalizedIntersectionManager.hpp.
Referenced by carma_wm::CARMAWorldModel::processSpatFromMsg().
std::unordered_map<uint16_t, std::unordered_map<uint8_t,std::vector<std::pair<boost::posix_time::ptime, lanelet::CarmaTrafficSignalState> > > > carma_wm::SignalizedIntersectionManager::traffic_signal_states_ |
Definition at line 163 of file SignalizedIntersectionManager.hpp.
Referenced by carma_wm::CARMAWorldModel::processSpatFromMsg().