Skip to content
Snippets Groups Projects
Commit 188b65ec authored by beuchatp's avatar beuchatp
Browse files

Adjusted the node handles in the fetch callbacks

parent 5dd18c89
No related branches found
No related tags found
No related merge requests found
...@@ -812,17 +812,8 @@ void yamlReadyForFetchCallback(const std_msgs::Int32& msg) ...@@ -812,17 +812,8 @@ void yamlReadyForFetchCallback(const std_msgs::Int32& msg)
// Switch between fetching for the different controllers and from different locations // Switch between fetching for the different controllers and from different locations
switch(controller_to_fetch_yaml) switch(controller_to_fetch_yaml)
{ {
case FETCH_YAML_CUSTOM_CONTROLLER_COORDINATOR:
{
// Let the user know that this message was received
ROS_INFO("The CustomControllerService received the message that YAML parameters were (re-)loaded. > Now fetching the parameter values from the coordinator.");
// Create a node handle to the parameter service running on the coordinator machine
ros::NodeHandle nodeHandle_to_coordinator_parameter_service = ros::NodeHandle(namespace_to_coordinator_parameter_service);
// Call the function that fetches the parameters
fetchYamlParameters(nodeHandle_to_coordinator_parameter_service);
break;
}
// > FOR FETCHING FROM THE AGENT'S OWN PARAMETER SERVICE
case FETCH_YAML_CUSTOM_CONTROLLER_AGENT: case FETCH_YAML_CUSTOM_CONTROLLER_AGENT:
{ {
// Let the user know that this message was received // Let the user know that this message was received
...@@ -834,6 +825,19 @@ void yamlReadyForFetchCallback(const std_msgs::Int32& msg) ...@@ -834,6 +825,19 @@ void yamlReadyForFetchCallback(const std_msgs::Int32& msg)
break; break;
} }
// > FOR FETCHING FROM THE COORDINATOR'S PARAMETER SERVICE
case FETCH_YAML_CUSTOM_CONTROLLER_COORDINATOR:
{
// Let the user know that this message was received
ROS_INFO("The CustomControllerService received the message that YAML parameters were (re-)loaded. > Now fetching the parameter values from the coordinator.");
// Create a node handle to the parameter service running on the coordinator machine
ros::NodeHandle nodeHandle_to_coordinator = ros::NodeHandle();
ros::NodeHandle nodeHandle_to_coordinator_parameter_service = ros::NodeHandle(nodeHandle_to_coordinator,namespace_to_coordinator_parameter_service);
// Call the function that fetches the parameters
fetchYamlParameters(nodeHandle_to_coordinator_parameter_service);
break;
}
default: default:
{ {
// Let the user know that the command was not relevant // Let the user know that the command was not relevant
......
...@@ -789,26 +789,30 @@ void yamlReadyForFetchCallback(const std_msgs::Int32& msg) ...@@ -789,26 +789,30 @@ void yamlReadyForFetchCallback(const std_msgs::Int32& msg)
// Switch between fetching for the different controllers and from different locations // Switch between fetching for the different controllers and from different locations
switch(controller_to_fetch_yaml) switch(controller_to_fetch_yaml)
{ {
case FETCH_YAML_SAFE_CONTROLLER_COORDINATOR:
// > FOR FETCHING FROM THE AGENT'S OWN PARAMETER SERVICE
case FETCH_YAML_SAFE_CONTROLLER_AGENT:
{ {
// Let the user know that this message was received // Let the user know that this message was received
// > and also from where the paramters are being fetched ROS_INFO("The PPSClient received the message that YAML parameters were (re-)loaded for the Safe Controller. > Now fetching the parameter values from this machine.");
ROS_INFO("The PPSClient received the message that YAML parameters were (re-)loaded for the Safe Controller. > Now fetching the parameter values from the coordinator."); // Create a node handle to the parameter service running on this agent's machine
// Create a node handle to the parameter service running on the coordinator machine ros::NodeHandle nodeHandle_to_own_agent_parameter_service(namespace_to_own_agent_parameter_service);
ros::NodeHandle nodeHandle_to_coordinator_parameter_service = ros::NodeHandle(namespace_to_coordinator_parameter_service);
// Call the function that fetches the parameters // Call the function that fetches the parameters
fetchYamlParametersForSafeController(nodeHandle_to_coordinator_parameter_service); fetchYamlParametersForSafeController(nodeHandle_to_own_agent_parameter_service);
break; break;
} }
case FETCH_YAML_SAFE_CONTROLLER_AGENT: // > FOR FETCHING FROM THE COORDINATOR'S PARAMETER SERVICE
case FETCH_YAML_SAFE_CONTROLLER_COORDINATOR:
{ {
// Let the user know that this message was received // Let the user know that this message was received
ROS_INFO("The PPSClient received the message that YAML parameters were (re-)loaded for the Safe Controller. > Now fetching the parameter values from this machine."); // > and also from where the paramters are being fetched
// Create a node handle to the parameter service running on this agent's machine ROS_INFO("The PPSClient received the message that YAML parameters were (re-)loaded for the Safe Controller. > Now fetching the parameter values from the coordinator.");
ros::NodeHandle nodeHandle_to_own_agent_parameter_service(namespace_to_own_agent_parameter_service); // Create a node handle to the parameter service running on the coordinator machine
ros::NodeHandle nodeHandle_to_coordinator = ros::NodeHandle();
ros::NodeHandle nodeHandle_to_coordinator_parameter_service = ros::NodeHandle(nodeHandle_to_coordinator,namespace_to_coordinator_parameter_service);
// Call the function that fetches the parameters // Call the function that fetches the parameters
fetchYamlParametersForSafeController(nodeHandle_to_own_agent_parameter_service); fetchYamlParametersForSafeController(nodeHandle_to_coordinator_parameter_service);
break; break;
} }
......
...@@ -383,17 +383,8 @@ void yamlReadyForFetchCallback(const std_msgs::Int32& msg) ...@@ -383,17 +383,8 @@ void yamlReadyForFetchCallback(const std_msgs::Int32& msg)
// Switch between fetching for the different controllers and from different locations // Switch between fetching for the different controllers and from different locations
switch(controller_to_fetch_yaml) switch(controller_to_fetch_yaml)
{ {
case FETCH_YAML_SAFE_CONTROLLER_COORDINATOR:
{
// Let the user know that this message was received
ROS_INFO("The SafeControllerService received the message that YAML parameters were (re-)loaded. > Now fetching the parameter values from the coordinator.");
// Create a node handle to the parameter service running on the coordinator machine
ros::NodeHandle nodeHandle_to_coordinator_parameter_service = ros::NodeHandle(namespace_to_coordinator_parameter_service);
// Call the function that fetches the parameters
fetchYamlParameters(nodeHandle_to_coordinator_parameter_service);
break;
}
// > FOR FETCHING FROM THE AGENT'S OWN PARAMETER SERVICE
case FETCH_YAML_SAFE_CONTROLLER_AGENT: case FETCH_YAML_SAFE_CONTROLLER_AGENT:
{ {
// Let the user know that this message was received // Let the user know that this message was received
...@@ -405,6 +396,19 @@ void yamlReadyForFetchCallback(const std_msgs::Int32& msg) ...@@ -405,6 +396,19 @@ void yamlReadyForFetchCallback(const std_msgs::Int32& msg)
break; break;
} }
// > FOR FETCHING FROM THE COORDINATOR'S PARAMETER SERVICE
case FETCH_YAML_SAFE_CONTROLLER_COORDINATOR:
{
// Let the user know that this message was received
ROS_INFO("The SafeControllerService received the message that YAML parameters were (re-)loaded. > Now fetching the parameter values from the coordinator.");
// Create a node handle to the parameter service running on the coordinator machine
ros::NodeHandle nodeHandle_to_coordinator = ros::NodeHandle();
ros::NodeHandle nodeHandle_to_coordinator_parameter_service = ros::NodeHandle(nodeHandle_to_coordinator,namespace_to_coordinator_parameter_service);
// Call the function that fetches the parameters
fetchYamlParameters(nodeHandle_to_coordinator_parameter_service);
break;
}
default: default:
{ {
// Let the user know that the command was not relevant // Let the user know that the command was not relevant
...@@ -630,7 +634,7 @@ int main(int argc, char* argv[]) { ...@@ -630,7 +634,7 @@ int main(int argc, char* argv[]) {
// FINALLY, FETCH ANY PARAMETERS REQUIRED FROM THESE "PARAMETER SERVICES" // FINALLY, FETCH ANY PARAMETERS REQUIRED FROM THESE "PARAMETER SERVICES"
// Call the class function that loads the parameters for this class. // Call the class function that loads the parameters for this class.
fetchYamlParameters(nodeHandle_to_own_agent_parameter_service); fetchYamlParameters(nodeHandle_to_own_agent_parameter_service);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment