From b587dec666fee4262e9ab8bf4492d767d02044a1 Mon Sep 17 00:00:00 2001
From: beuchatp <beuchatp@control.ee.ethz.ch>
Date: Mon, 4 Dec 2017 17:16:54 +0100
Subject: [PATCH] Adjusted namespacing from the Safe Controller to link with
 the Parameer Service

---
 pps_ws/src/d_fall_pps/src/ParameterService.cpp      | 4 ++--
 pps_ws/src/d_fall_pps/src/SafeControllerService.cpp | 7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/pps_ws/src/d_fall_pps/src/ParameterService.cpp b/pps_ws/src/d_fall_pps/src/ParameterService.cpp
index c59e9c5e..4a70d98c 100755
--- a/pps_ws/src/d_fall_pps/src/ParameterService.cpp
+++ b/pps_ws/src/d_fall_pps/src/ParameterService.cpp
@@ -333,7 +333,7 @@ int main(int argc, char* argv[])
         case TYPE_AGENT:
         {
             //m_ros_namespace = ros::this_node::getNamespace();
-            m_ros_namespace = "/" + std::to_string(my_agentID) + "/" + "ParameterService";
+            m_ros_namespace = "/" + std::to_string(my_agentID) + '/' + "ParameterService";
             ROS_INFO_STREAM("This Paramter Sercice will load .yaml file parameters into the 'base' namespace: " << m_ros_namespace);
             break;
         }
@@ -343,7 +343,7 @@ int main(int argc, char* argv[])
         case TYPE_COORDINATOR:
         {
             //m_ros_namespace = ros::this_node::getNamespace();
-            m_ros_namespace = "/" + "ParameterService";
+            m_ros_namespace = '/' + "ParameterService";
             ROS_INFO_STREAM("This Paramter Sercice will load .yaml file parameters into the 'base' namespace: " << m_ros_namespace);
             break;
         }
diff --git a/pps_ws/src/d_fall_pps/src/SafeControllerService.cpp b/pps_ws/src/d_fall_pps/src/SafeControllerService.cpp
index 24c898c1..b8482f9a 100755
--- a/pps_ws/src/d_fall_pps/src/SafeControllerService.cpp
+++ b/pps_ws/src/d_fall_pps/src/SafeControllerService.cpp
@@ -584,7 +584,7 @@ int main(int argc, char* argv[]) {
     // Set the class variable "namespace_to_own_agent_parameter_service" to be a the
     // namespace string for the parameter service that is running on the machine of this
     // agent
-    namespace_to_own_agent_parameter_service = "ParameterService";
+    namespace_to_own_agent_parameter_service = m_namespace + "/ParameterService";
     
     // Create a node handle to the parameter service running on this agent's machine
     ros::NodeHandle nodeHandle_to_own_agent_parameter_service(namespace_to_own_agent_parameter_service);
@@ -611,6 +611,11 @@ int main(int argc, char* argv[]) {
     // "yamlReadyForFetchCallback" class function.
     ros::Subscriber controllerYamlReadyForFetchSubscriber_to_coordinator = nodeHandle_to_coordinator_parameter_service.subscribe("controllerYamlReadyForFetch", 1, yamlReadyForFetchCallback);
 
+    // Let the user know what namespaces are being used for linking to the parameter service
+    ROS_INFO_STREAM("The namespace string for accessing the Paramter Services are:");
+    ROS_INFO_STREAM("namespace_to_own_agent_parameter_service    =  " << namespace_to_own_agent_parameter_service);
+    ROS_INFO_STREAM("namespace_to_coordinator_parameter_service  =  " << namespace_to_coordinator_parameter_service);
+
     // Call the class function that loads the parameters for this class.
     fetchYamlParameters(nodeHandle_to_own_agent_parameter_service);
 
-- 
GitLab