From f968fbed2f32c7b17bfa315bc168cf428cd9457d Mon Sep 17 00:00:00 2001 From: Olivier Stasse <ostasse@laas.fr> Date: Sun, 3 Dec 2023 21:45:32 +0100 Subject: [PATCH] [ros_python_interpreter] Add the possibility to get the callback_group of reentrant type. --- .../dynamic_graph_bridge/ros_python_interpreter_server.hpp | 5 ++++- src/ros_python_interpreter_server.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/dynamic_graph_bridge/ros_python_interpreter_server.hpp b/include/dynamic_graph_bridge/ros_python_interpreter_server.hpp index 48f6f85..a398549 100644 --- a/include/dynamic_graph_bridge/ros_python_interpreter_server.hpp +++ b/include/dynamic_graph_bridge/ros_python_interpreter_server.hpp @@ -85,8 +85,11 @@ class RosPythonInterpreterServer { /** * @brief start_ros_service advertize the "run_python_command" and * "run_python_scripts" ros services + * @param qos: Quality of Service + * @param callback_group: Callback group */ - void start_ros_service(); + void start_ros_service(const rclcpp::QoS& qos = rclcpp::ServicesQoS(), + rclcpp::CallbackGroup::SharedPtr group = nullptr); protected: /** diff --git a/src/ros_python_interpreter_server.cpp b/src/ros_python_interpreter_server.cpp index ce92f7d..272e5d4 100644 --- a/src/ros_python_interpreter_server.cpp +++ b/src/ros_python_interpreter_server.cpp @@ -25,12 +25,13 @@ RosPythonInterpreterServer::RosPythonInterpreterServer() RosPythonInterpreterServer::~RosPythonInterpreterServer() {} -void RosPythonInterpreterServer::start_ros_service() { +void RosPythonInterpreterServer::start_ros_service( + const rclcpp::QoS& qos, rclcpp::CallbackGroup::SharedPtr group) { run_python_command_callback_t runCommandCb = std::bind(&RosPythonInterpreterServer::runCommandCallback, this, std::placeholders::_1, std::placeholders::_2); run_python_command_srv_ = ros_node_->create_service<RunPythonCommandSrvType>( - "/dynamic_graph_bridge/run_python_command", runCommandCb); + "/dynamic_graph_bridge/run_python_command", runCommandCb, qos, group); RCLCPP_INFO( rclcpp::get_logger("dynamic_graph_bridge"), "RosPythonInterpreterServer::start_ros_service - run_python_command..."); @@ -39,7 +40,7 @@ void RosPythonInterpreterServer::start_ros_service() { std::bind(&RosPythonInterpreterServer::runPythonFileCallback, this, std::placeholders::_1, std::placeholders::_2); run_python_file_srv_ = ros_node_->create_service<RunPythonFileSrvType>( - "/dynamic_graph_bridge/run_python_file", runPythonFileCb); + "/dynamic_graph_bridge/run_python_file", runPythonFileCb, qos, group); RCLCPP_INFO( rclcpp::get_logger("dynamic_graph_bridge"), -- GitLab