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.
carma_cooperative_perception::SdsmToDetectionListNode Class Reference

#include <sdsm_to_detection_list_component.hpp>

Inheritance diagram for carma_cooperative_perception::SdsmToDetectionListNode:
Inheritance graph
Collaboration diagram for carma_cooperative_perception::SdsmToDetectionListNode:
Collaboration graph

Public Member Functions

 SdsmToDetectionListNode (const rclcpp::NodeOptions &options)
 
auto sdsm_msg_callback (const input_msg_type &msg) const -> void
 

Private Types

using input_msg_type = carma_v2x_msgs::msg::SensorDataSharingMessage
 
using input_msg_shared_pointer = typename input_msg_type::SharedPtr
 
using output_msg_type = carma_cooperative_perception_interfaces::msg::DetectionList
 

Private Attributes

rclcpp::Publisher< output_msg_type >::SharedPtr publisher_
 
rclcpp::Subscription< input_msg_type >::SharedPtr subscription_
 
rclcpp::Subscription< std_msgs::msg::String >::SharedPtr georeference_subscription_
 
rclcpp::Subscription< rosgraph_msgs::msg::Clock >::SharedPtr cdasim_clock_sub_
 
std::optional< rclcpp::Time > cdasim_time_ {std::nullopt}
 
std::string georeference_ {""}
 

Detailed Description

Definition at line 31 of file sdsm_to_detection_list_component.hpp.

Member Typedef Documentation

◆ input_msg_shared_pointer

using carma_cooperative_perception::SdsmToDetectionListNode::input_msg_shared_pointer = typename input_msg_type::SharedPtr
private

Definition at line 34 of file sdsm_to_detection_list_component.hpp.

◆ input_msg_type

using carma_cooperative_perception::SdsmToDetectionListNode::input_msg_type = carma_v2x_msgs::msg::SensorDataSharingMessage
private

Definition at line 33 of file sdsm_to_detection_list_component.hpp.

◆ output_msg_type

using carma_cooperative_perception::SdsmToDetectionListNode::output_msg_type = carma_cooperative_perception_interfaces::msg::DetectionList
private

Definition at line 35 of file sdsm_to_detection_list_component.hpp.

Constructor & Destructor Documentation

◆ SdsmToDetectionListNode()

carma_cooperative_perception::SdsmToDetectionListNode::SdsmToDetectionListNode ( const rclcpp::NodeOptions &  options)
inlineexplicit

Definition at line 38 of file sdsm_to_detection_list_component.hpp.

39 : CarmaLifecycleNode{options},
40 publisher_{create_publisher<output_msg_type>("output/detections", 1)},
41 subscription_{create_subscription<input_msg_type>(
42 "input/sdsm", 1, [this](input_msg_shared_pointer msg_ptr) { sdsm_msg_callback(*msg_ptr); })},
43 georeference_subscription_{create_subscription<std_msgs::msg::String>(
44 "input/georeference", 1,
45 [this](std_msgs::msg::String::SharedPtr msg_ptr) { georeference_ = msg_ptr->data; })},
46 cdasim_clock_sub_{create_subscription<rosgraph_msgs::msg::Clock>(
47 "input/cdasim_clock", 1, [this](rosgraph_msgs::msg::Clock::ConstSharedPtr msg_ptr) {
48 cdasim_time_ = msg_ptr->clock;
49 })}
50 {
51 }
rclcpp::Subscription< input_msg_type >::SharedPtr subscription_
rclcpp::Subscription< std_msgs::msg::String >::SharedPtr georeference_subscription_
rclcpp::Publisher< output_msg_type >::SharedPtr publisher_
rclcpp::Subscription< rosgraph_msgs::msg::Clock >::SharedPtr cdasim_clock_sub_
auto sdsm_msg_callback(const input_msg_type &msg) const -> void

References sdsm_msg_callback().

Here is the call graph for this function:

Member Function Documentation

◆ sdsm_msg_callback()

auto carma_cooperative_perception::SdsmToDetectionListNode::sdsm_msg_callback ( const input_msg_type msg) const -> void
inline

Definition at line 53 of file sdsm_to_detection_list_component.hpp.

54 {
55 try {
56 auto detection_list_msg{to_detection_list_msg(msg, georeference_)};
57
58 if (cdasim_time_) {
59 // When in simulation, ROS time is CARLA time, but SDSMs use CDASim time
60 const auto time_delta{now() - cdasim_time_.value()};
61
62 for (auto & detection : detection_list_msg.detections) {
63 detection.header.stamp = rclcpp::Time(detection.header.stamp) + time_delta;
64 }
65 }
66
67 publisher_->publish(detection_list_msg);
68 } catch (const std::runtime_error & e) {
69 RCLCPP_ERROR_STREAM(get_logger(), "Failed to convert SDSM to detection list: " << e.what());
70 }
71 }
auto to_detection_list_msg(const carma_v2x_msgs::msg::SensorDataSharingMessage &sdsm, std::string_view georeference) -> carma_cooperative_perception_interfaces::msg::DetectionList

References carma_cooperative_perception::to_detection_list_msg().

Referenced by SdsmToDetectionListNode().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ cdasim_clock_sub_

rclcpp::Subscription<rosgraph_msgs::msg::Clock>::SharedPtr carma_cooperative_perception::SdsmToDetectionListNode::cdasim_clock_sub_
private

Definition at line 78 of file sdsm_to_detection_list_component.hpp.

◆ cdasim_time_

std::optional<rclcpp::Time> carma_cooperative_perception::SdsmToDetectionListNode::cdasim_time_ {std::nullopt}
private

Definition at line 79 of file sdsm_to_detection_list_component.hpp.

◆ georeference_

std::string carma_cooperative_perception::SdsmToDetectionListNode::georeference_ {""}
private

Definition at line 81 of file sdsm_to_detection_list_component.hpp.

◆ georeference_subscription_

rclcpp::Subscription<std_msgs::msg::String>::SharedPtr carma_cooperative_perception::SdsmToDetectionListNode::georeference_subscription_
private

Definition at line 76 of file sdsm_to_detection_list_component.hpp.

◆ publisher_

rclcpp::Publisher<output_msg_type>::SharedPtr carma_cooperative_perception::SdsmToDetectionListNode::publisher_
private

Definition at line 74 of file sdsm_to_detection_list_component.hpp.

◆ subscription_

rclcpp::Subscription<input_msg_type>::SharedPtr carma_cooperative_perception::SdsmToDetectionListNode::subscription_
private

Definition at line 75 of file sdsm_to_detection_list_component.hpp.


The documentation for this class was generated from the following file: