17#include <rclcpp_components/register_node_macro.hpp>
29 const rclcpp::NodeOptions & options)
30: CarmaLifecycleNode{options}
37 const rclcpp_lifecycle::State & ) -> carma_ros2_utils::CallbackReturn
39 publisher_ = create_publisher<carma_perception_msgs::msg::ExternalObjectList>(
40 "output/external_object_list", 1);
42 track_list_subscription_ = create_subscription<
43 carma_cooperative_perception_interfaces::msg::TrackList>(
44 "input/track_list", 1,
45 [
this](
const carma_cooperative_perception_interfaces::msg::TrackList::SharedPtr msg_ptr) {
46 if (
const auto current_state{this->get_current_state().label()}; current_state ==
"active") {
47 publish_as_external_object_list(*msg_ptr);
51 "Trying to receive message on the topic '%s', but the containing node is not activated. "
52 "Current node state: '%s'",
53 this->track_list_subscription_->get_topic_name(), current_state.c_str());
57 return carma_ros2_utils::CallbackReturn::SUCCESS;
61 const rclcpp_lifecycle::State & ) -> carma_ros2_utils::CallbackReturn
64 track_list_subscription_.reset();
66 return carma_ros2_utils::CallbackReturn::SUCCESS;
70 const rclcpp_lifecycle::State & ) -> carma_ros2_utils::CallbackReturn
73 track_list_subscription_.reset();
75 return carma_ros2_utils::CallbackReturn::SUCCESS;
79 const carma_cooperative_perception_interfaces::msg::TrackList & msg)
const ->
void
82 external_object_list.header.stamp = now();
83 external_object_list.header.frame_id =
"map";
85 publisher_->publish(external_object_list);
94RCLCPP_COMPONENTS_REGISTER_NODE(
rclcpp_lifecycle::LifecyclePublisher< carma_perception_msgs::msg::ExternalObjectList >::SharedPtr publisher_
auto handle_on_cleanup(const rclcpp_lifecycle::State &) -> carma_ros2_utils::CallbackReturn override
auto handle_on_shutdown(const rclcpp_lifecycle::State &) -> carma_ros2_utils::CallbackReturn override
auto publish_as_external_object_list(const carma_cooperative_perception_interfaces::msg::TrackList &msg) const -> void
OnSetParametersCallbackHandle::SharedPtr on_set_parameters_callback_
auto handle_on_configure(const rclcpp_lifecycle::State &) -> carma_ros2_utils::CallbackReturn override
TrackListToExternalObjectListNode(const rclcpp::NodeOptions &options)
auto to_external_object_list_msg(const carma_cooperative_perception_interfaces::msg::TrackList &track_list) -> carma_perception_msgs::msg::ExternalObjectList