From b6245f29c3302849a85a6485a1c9a46d3fbb8111 Mon Sep 17 00:00:00 2001 From: Mauro Passerino Date: Wed, 23 Mar 2022 15:31:29 +0000 Subject: [PATCH] IPC Client/Service to match Subscription approach Signed-off-by: Mauro Passerino --- rclcpp/include/rclcpp/client.hpp | 10 +++++----- rclcpp/include/rclcpp/service.hpp | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/rclcpp/include/rclcpp/client.hpp b/rclcpp/include/rclcpp/client.hpp index ff69dc1661..92dfddaee6 100644 --- a/rclcpp/include/rclcpp/client.hpp +++ b/rclcpp/include/rclcpp/client.hpp @@ -379,6 +379,9 @@ class ClientBase uint64_t intra_process_client_id, IntraProcessManagerWeakPtr weak_ipm); + std::shared_ptr client_intra_process_; + std::atomic_uint ipc_sequence_number_{1}; + rclcpp::node_interfaces::NodeGraphInterface::WeakPtr node_graph_; std::shared_ptr node_handle_; std::shared_ptr context_; @@ -898,6 +901,8 @@ class Client : public ClientBase } // Create a ClientIntraProcess which will be given to the intra-process manager. + using ClientIntraProcessT = rclcpp::experimental::ClientIntraProcess; + client_intra_process_ = std::make_shared( context_, this->get_service_name(), @@ -919,11 +924,6 @@ class Client : public ClientBase CallbackInfoVariant>> pending_requests_; std::mutex pending_requests_mutex_; - -private: - using ClientIntraProcessT = rclcpp::experimental::ClientIntraProcess; - std::shared_ptr client_intra_process_; - std::atomic_uint ipc_sequence_number_{1}; }; } // namespace rclcpp diff --git a/rclcpp/include/rclcpp/service.hpp b/rclcpp/include/rclcpp/service.hpp index 515a3c363a..a4cbf0715a 100644 --- a/rclcpp/include/rclcpp/service.hpp +++ b/rclcpp/include/rclcpp/service.hpp @@ -289,6 +289,8 @@ class ServiceBase uint64_t intra_process_service_id, IntraProcessManagerWeakPtr weak_ipm); + std::shared_ptr service_intra_process_; + std::shared_ptr node_handle_; std::shared_ptr context_; @@ -552,6 +554,8 @@ class Service } // Create a ServiceIntraProcess which will be given to the intra-process manager. + using ServiceIntraProcessT = rclcpp::experimental::ServiceIntraProcess; + service_intra_process_ = std::make_shared( any_callback_, context_, @@ -568,9 +572,6 @@ class Service RCLCPP_DISABLE_COPY(Service) AnyServiceCallback any_callback_; - - using ServiceIntraProcessT = rclcpp::experimental::ServiceIntraProcess; - std::shared_ptr service_intra_process_; }; } // namespace rclcpp