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

Fixed subscriber inside switch case not persisting

parent d9fd6069
No related branches found
No related tags found
No related merge requests found
...@@ -109,6 +109,8 @@ ros::Publisher controllerYamlReadyForFetchPublihser; ...@@ -109,6 +109,8 @@ ros::Publisher controllerYamlReadyForFetchPublihser;
std::string m_ros_namespace; std::string m_ros_namespace;
ros::Subscriber requestLoadControllerYamlSubscriber_agent_to_self;
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
// FFFFF U U N N CCCC TTTTT III OOO N N // FFFFF U U N N CCCC TTTTT III OOO N N
...@@ -352,12 +354,15 @@ int main(int argc, char* argv[]) ...@@ -352,12 +354,15 @@ int main(int argc, char* argv[])
// > Subscribe to requests from: the agent's own "PPSClient" node // > Subscribe to requests from: the agent's own "PPSClient" node
//std::string temp_this_node_namespace = ros::this_node::getNamespace(); //std::string temp_this_node_namespace = ros::this_node::getNamespace();
//ros::NodeHandle nh_PPSClient_for_this_agent(temp_this_node_namespace + "/PPSClient"); //ros::NodeHandle nh_PPSClient_for_this_agent(temp_this_node_namespace + "/PPSClient");
ros::NodeHandle nh_PPSClient_for_this_agent(nodeHandle,"PPSClient");
ros::Subscriber requestLoadControllerYamlSubscriber_agent_to_self = nh_PPSClient_for_this_agent.subscribe("requestLoadControllerYaml", 1, requestLoadControllerYamlCallback); ros::NodeHandle nh_PPSClient_for_this("PPSClient");
ros::Subscriber requestLoadContr = nh_PPSClient_for_this.subscribe("hfsfhjfshjfsjfshsdgdagdasgdagad", 1, requestLoadControllerYamlCallback);
ROS_INFO_STREAM("This Parameter Service has subscribed to 'requestLoadControllerYaml' messages from both the 'my_GUI' and the 'PPSClient'"); ROS_INFO_STREAM("This Parameter Service has subscribed to 'requestLoadControllerYaml' messages from both the 'my_GUI' and the 'PPSClient'");
ros::Duration(5).sleep();
break; break;
} }
...@@ -368,6 +373,15 @@ int main(int argc, char* argv[]) ...@@ -368,6 +373,15 @@ int main(int argc, char* argv[])
} }
} }
ros::Subscriber requestLoadControllerYamlSubscriber_agent_to_self;
ros::Subscriber requestLoadControllerYamlSubscriber_agent_to_selffdxfd;
if (my_type==TYPE_AGENT)
{
ros::NodeHandle nh_PPSClient_for_this_agent("PPSClient");
requestLoadControllerYamlSubscriber_agent_to_self = nh_PPSClient_for_this_agent.subscribe("requestLoadControllerYaml", 1, requestLoadControllerYamlCallback);
}
// Subscriber for requests that the controller parameters should be re-loaded from // Subscriber for requests that the controller parameters should be re-loaded from
// the .YAML files on the coordinators machine, and then all the agents should be // the .YAML files on the coordinators machine, and then all the agents should be
......
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