From b9dd026bf5feabbd7b0100d13a354937adf6f4d0 Mon Sep 17 00:00:00 2001 From: john-maidbot Date: Sat, 11 May 2024 12:59:36 -0500 Subject: [PATCH] Fix for getParam name resolution --- .../point_cloud_transport/simple_publisher_plugin.hpp | 8 +++++++- .../point_cloud_transport/simple_subscriber_plugin.hpp | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/point_cloud_transport/include/point_cloud_transport/simple_publisher_plugin.hpp b/point_cloud_transport/include/point_cloud_transport/simple_publisher_plugin.hpp index 3d3531f..ee19122 100644 --- a/point_cloud_transport/include/point_cloud_transport/simple_publisher_plugin.hpp +++ b/point_cloud_transport/include/point_cloud_transport/simple_publisher_plugin.hpp @@ -94,7 +94,13 @@ class SimplePublisherPlugin : public point_cloud_transport::PublisherPlugin bool getParam(const std::string & name, T & value) const { if (simple_impl_) { - return simple_impl_->node_->get_parameter(name, value); + uint ns_len = simple_impl_->node_->get_effective_namespace().length(); + std::string param_base_name = getTopic().substr(ns_len); + std::replace(param_base_name.begin(), param_base_name.end(), '/', '.'); + + std::string param_name = param_base_name + "." + name; + + return simple_impl_->node_->get_parameter(param_name, value); } return false; } diff --git a/point_cloud_transport/include/point_cloud_transport/simple_subscriber_plugin.hpp b/point_cloud_transport/include/point_cloud_transport/simple_subscriber_plugin.hpp index 511fe07..051e935 100644 --- a/point_cloud_transport/include/point_cloud_transport/simple_subscriber_plugin.hpp +++ b/point_cloud_transport/include/point_cloud_transport/simple_subscriber_plugin.hpp @@ -92,7 +92,13 @@ class SimpleSubscriberPlugin : public SubscriberPlugin bool getParam(const std::string & name, T & value) const { if (impl_) { - return impl_->node_->get_parameter(name, value); + uint ns_len = impl_->node_->get_effective_namespace().length(); + std::string param_base_name = getTopic().substr(ns_len); + std::replace(param_base_name.begin(), param_base_name.end(), '/', '.'); + + std::string param_name = param_base_name + "." + name; + + return impl_->node_->get_parameter(param_name, value); } return false; }