From 9f6d56075460cd4406364637e82b74791b1164f3 Mon Sep 17 00:00:00 2001 From: Joshua Hampp Date: Fri, 17 Apr 2020 19:16:37 +0200 Subject: [PATCH] enabled publishing of rcl_serialized_message_t --- rclcpp/include/rclcpp/publisher.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rclcpp/include/rclcpp/publisher.hpp b/rclcpp/include/rclcpp/publisher.hpp index 09aff0018a..3261f80df1 100644 --- a/rclcpp/include/rclcpp/publisher.hpp +++ b/rclcpp/include/rclcpp/publisher.hpp @@ -207,6 +207,13 @@ class Publisher : public PublisherBase this->do_publish_message(msg); } + template + typename std::enable_if::value>::type + publish(const rcl_serialized_message_t & serialized_msg) + { + this->do_publish_message(serialized_msg); + } + /// Publish a serialized message. Non specialized version to prevent compiling errors. template void publish(std::unique_ptr serialized_msg) @@ -322,7 +329,7 @@ class Publisher : public PublisherBase template typename std::enable_if::value>::type - do_publish_message(const MessageT & msg) + do_publish_message(const T & msg) { // Kept for backwards compatibility. Copies compelete memory! this->publish(std::make_unique(msg));