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.
|
#include <traffic_incident_parser_worker.hpp>
Public Types | |
using | PublishTrafficControlCallback = std::function< void(const carma_v2x_msgs::msg::TrafficControlMessage &)> |
Public Member Functions | |
TrafficIncidentParserWorker (carma_wm::WorldModelConstPtr wm, const PublishTrafficControlCallback &traffic_control_pub, rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger, rclcpp::Clock::SharedPtr clock) | |
TrafficIncidentParserWorker constructor. More... | |
void | georeferenceCallback (std_msgs::msg::String::UniquePtr projection_msg) |
Callback for the georeference subscriber used to set the map projection. More... | |
void | mobilityOperationCallback (carma_v2x_msgs::msg::MobilityOperation::UniquePtr mobility_msg) |
Function to receive the incoming mobility operation message from the message node and publish the geofence message upon processing the mobility msg. Only incoming mobility operation messages with strategy "carma3/Incident_Use_Case" are processed. More... | |
bool | mobilityMessageParser (std::string mobility_strategy_params) |
Function to help parse incoming mobility operation messages to required format. More... | |
std::string | stringParserHelper (std::string str, unsigned long str_index) const |
Function to help convert string to double data type. More... | |
std::vector< carma_v2x_msgs::msg::TrafficControlMessageV01 > | composeTrafficControlMesssages () |
Algorithm for extracting the closed lanelet from internally saved mobility message (or geofence) params and assigning it to a traffic contol message. Closed lanelets are represent by vector of points, where each point represents the geometric middle point of a closed lanelet. More... | |
lanelet::BasicPoint2d | getIncidentOriginPoint () const |
Function to convert internally saved incident origin point from lat/lon to local map frame. More... | |
void | getAdjacentForwardCenterlines (const lanelet::ConstLanelets &adjacentSet, const lanelet::BasicPoint2d &start_point, double downtrack, std::vector< std::vector< lanelet::BasicPoint2d > > *forward_lanes) const |
Helper method to compute the concatenated centerlines of the lanes in front of the emergency vehicle point. More... | |
void | getAdjacentReverseCenterlines (const lanelet::ConstLanelets &adjacentSet, const lanelet::BasicPoint2d &start_point, double uptrack, std::vector< std::vector< lanelet::BasicPoint2d > > *reverse_lanes) const |
Helper method that is identical to getAdjacentForwardCenterlines except it works in reverse using uptrack distance. More... | |
Public Attributes | |
double | latitude = 0.0 |
double | longitude = 0.0 |
double | down_track = 0.0 |
double | up_track = 0.0 |
double | min_gap = 0.0 |
double | speed_advisory = 0.0 |
std::string | event_reason |
std::string | event_type |
std::string | previous_strategy_params ="" |
Private Attributes | |
lanelet::BasicPoint2d | local_point_ |
std::string | projection_msg_ |
PublishTrafficControlCallback | traffic_control_pub_ |
carma_wm::WorldModelConstPtr | wm_ |
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr | logger_ |
rclcpp::Clock::SharedPtr | clock_ |
Definition at line 43 of file traffic_incident_parser_worker.hpp.
using traffic_incident_parser::TrafficIncidentParserWorker::PublishTrafficControlCallback = std::function<void(const carma_v2x_msgs::msg::TrafficControlMessage&)> |
Definition at line 48 of file traffic_incident_parser_worker.hpp.
traffic_incident_parser::TrafficIncidentParserWorker::TrafficIncidentParserWorker | ( | carma_wm::WorldModelConstPtr | wm, |
const PublishTrafficControlCallback & | traffic_control_pub, | ||
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr | logger, | ||
rclcpp::Clock::SharedPtr | clock | ||
) |
TrafficIncidentParserWorker constructor.
Definition at line 28 of file traffic_incident_parser_worker.cpp.
std::vector< carma_v2x_msgs::msg::TrafficControlMessageV01 > traffic_incident_parser::TrafficIncidentParserWorker::composeTrafficControlMesssages | ( | ) |
Algorithm for extracting the closed lanelet from internally saved mobility message (or geofence) params and assigning it to a traffic contol message. Closed lanelets are represent by vector of points, where each point represents the geometric middle point of a closed lanelet.
Definition at line 277 of file traffic_incident_parser_worker.cpp.
References clock_, down_track, event_reason, getAdjacentForwardCenterlines(), getAdjacentReverseCenterlines(), getIncidentOriginPoint(), process_bag::i, local_point_, logger_, min_gap, projection_msg_, speed_advisory, up_track, and wm_.
Referenced by mobilityOperationCallback().
void traffic_incident_parser::TrafficIncidentParserWorker::georeferenceCallback | ( | std_msgs::msg::String::UniquePtr | projection_msg | ) |
Callback for the georeference subscriber used to set the map projection.
msg | The latest georeference. |
Definition at line 58 of file traffic_incident_parser_worker.cpp.
References projection_msg_.
Referenced by traffic_incident_parser::TrafficIncidentParserNode::handle_on_configure().
void traffic_incident_parser::TrafficIncidentParserWorker::getAdjacentForwardCenterlines | ( | const lanelet::ConstLanelets & | adjacentSet, |
const lanelet::BasicPoint2d & | start_point, | ||
double | downtrack, | ||
std::vector< std::vector< lanelet::BasicPoint2d > > * | forward_lanes | ||
) | const |
Helper method to compute the concatenated centerlines of the lanes in front of the emergency vehicle point.
adjacentSet | The set of adjacent lanes to start from |
start_point | Point to start the downtrack calculation from. Should be the emergency vehicle points |
downtrack | downtrack distance to grab centerline points from |
forward_lanes | Ouput parameter which will be populated with the centerlines for each lane up to the downtrack distance |
Definition at line 183 of file traffic_incident_parser_worker.cpp.
References traffic_incident_parser::getNearestPointIndex(), logger_, and wm_.
Referenced by composeTrafficControlMesssages().
void traffic_incident_parser::TrafficIncidentParserWorker::getAdjacentReverseCenterlines | ( | const lanelet::ConstLanelets & | adjacentSet, |
const lanelet::BasicPoint2d & | start_point, | ||
double | uptrack, | ||
std::vector< std::vector< lanelet::BasicPoint2d > > * | reverse_lanes | ||
) | const |
Helper method that is identical to getAdjacentForwardCenterlines except it works in reverse using uptrack distance.
adjacentSet | The set of adjacent lanes to start from |
start_point | Point to start the downtrack calculation from. Should be the emergency vehicle points |
downtrack | downtrack distance to grab centerline points from |
forward_lanes | Ouput parameter which will be populated with the centerlines for each lane up to the downtrack distance |
Definition at line 230 of file traffic_incident_parser_worker.cpp.
References traffic_incident_parser::getNearestPointIndex(), logger_, and wm_.
Referenced by composeTrafficControlMesssages().
lanelet::BasicPoint2d traffic_incident_parser::TrafficIncidentParserWorker::getIncidentOriginPoint | ( | ) | const |
Function to convert internally saved incident origin point from lat/lon to local map frame.
Definition at line 149 of file traffic_incident_parser_worker.cpp.
References latitude, longitude, and projection_msg_.
Referenced by composeTrafficControlMesssages().
bool traffic_incident_parser::TrafficIncidentParserWorker::mobilityMessageParser | ( | std::string | mobility_strategy_params | ) |
Function to help parse incoming mobility operation messages to required format.
mobility_strategy_params | The strategy params associated with an incoming mobility operation message. |
Definition at line 64 of file traffic_incident_parser_worker.cpp.
References down_track, event_reason, event_type, latitude, logger_, longitude, min_gap, speed_advisory, stringParserHelper(), and up_track.
Referenced by mobilityOperationCallback().
void traffic_incident_parser::TrafficIncidentParserWorker::mobilityOperationCallback | ( | carma_v2x_msgs::msg::MobilityOperation::UniquePtr | mobility_msg | ) |
Function to receive the incoming mobility operation message from the message node and publish the geofence message upon processing the mobility msg. Only incoming mobility operation messages with strategy "carma3/Incident_Use_Case" are processed.
mobility_msg | Incoming mobility operation message |
Definition at line 32 of file traffic_incident_parser_worker.cpp.
References composeTrafficControlMesssages(), event_type, mobilityMessageParser(), previous_strategy_params, and traffic_control_pub_.
Referenced by traffic_incident_parser::TrafficIncidentParserNode::handle_on_configure().
std::string traffic_incident_parser::TrafficIncidentParserWorker::stringParserHelper | ( | std::string | str, |
unsigned long | str_index | ||
) | const |
Function to help convert string to double data type.
str | String object from which to extract the numeric value (a double). |
str_idx | The String object's index to start looking at. |
Definition at line 139 of file traffic_incident_parser_worker.cpp.
References process_bag::i.
Referenced by mobilityMessageParser().
|
private |
Definition at line 138 of file traffic_incident_parser_worker.hpp.
Referenced by composeTrafficControlMesssages().
double traffic_incident_parser::TrafficIncidentParserWorker::down_track = 0.0 |
Definition at line 120 of file traffic_incident_parser_worker.hpp.
Referenced by composeTrafficControlMesssages(), and mobilityMessageParser().
std::string traffic_incident_parser::TrafficIncidentParserWorker::event_reason |
Definition at line 124 of file traffic_incident_parser_worker.hpp.
Referenced by composeTrafficControlMesssages(), and mobilityMessageParser().
std::string traffic_incident_parser::TrafficIncidentParserWorker::event_type |
Definition at line 125 of file traffic_incident_parser_worker.hpp.
Referenced by mobilityMessageParser(), and mobilityOperationCallback().
double traffic_incident_parser::TrafficIncidentParserWorker::latitude = 0.0 |
Definition at line 118 of file traffic_incident_parser_worker.hpp.
Referenced by getIncidentOriginPoint(), and mobilityMessageParser().
|
private |
Definition at line 131 of file traffic_incident_parser_worker.hpp.
Referenced by composeTrafficControlMesssages().
|
private |
Definition at line 136 of file traffic_incident_parser_worker.hpp.
Referenced by composeTrafficControlMesssages(), getAdjacentForwardCenterlines(), getAdjacentReverseCenterlines(), and mobilityMessageParser().
double traffic_incident_parser::TrafficIncidentParserWorker::longitude = 0.0 |
Definition at line 119 of file traffic_incident_parser_worker.hpp.
Referenced by getIncidentOriginPoint(), and mobilityMessageParser().
double traffic_incident_parser::TrafficIncidentParserWorker::min_gap = 0.0 |
Definition at line 122 of file traffic_incident_parser_worker.hpp.
Referenced by composeTrafficControlMesssages(), and mobilityMessageParser().
std::string traffic_incident_parser::TrafficIncidentParserWorker::previous_strategy_params ="" |
Definition at line 127 of file traffic_incident_parser_worker.hpp.
Referenced by mobilityOperationCallback().
|
private |
Definition at line 132 of file traffic_incident_parser_worker.hpp.
Referenced by composeTrafficControlMesssages(), georeferenceCallback(), and getIncidentOriginPoint().
double traffic_incident_parser::TrafficIncidentParserWorker::speed_advisory = 0.0 |
Definition at line 123 of file traffic_incident_parser_worker.hpp.
Referenced by composeTrafficControlMesssages(), and mobilityMessageParser().
|
private |
Definition at line 133 of file traffic_incident_parser_worker.hpp.
Referenced by mobilityOperationCallback().
double traffic_incident_parser::TrafficIncidentParserWorker::up_track = 0.0 |
Definition at line 121 of file traffic_incident_parser_worker.hpp.
Referenced by composeTrafficControlMesssages(), and mobilityMessageParser().
|
private |
Definition at line 134 of file traffic_incident_parser_worker.hpp.
Referenced by composeTrafficControlMesssages(), getAdjacentForwardCenterlines(), and getAdjacentReverseCenterlines().