What is the ROS way to start/pause/shutdown nodes from within other nodes?
Iam looking for the best practice model to control nodes start/pause/shutdown with c++.
Use-cases:
Separating move_base, navigation, localization and manipulation.
Switching between localization nodes to achieve higher precision.
It seems that tf would be the biggest problem, as map -> odom -> base_link would get interrupted bringing all related nodes down as well.
I know is not exactly a correct (due to the fact you specified c++) but a workaround could be to do a small rospy node with an action callback which subscribes to an action which allows to do the "node management" allowing to start, pause and shutdown the system. Then, from any other cpp node, sending information with this action, you should be available to control the nodes.
I'm just proposing this approach because is the one I am using and I am satisfied with the results, but seeing that you are trying to do that in order to optimise resource management, i do not know if it will be the perfect approach for you.
Thanks for the reply @solrac . If its an "easy fix" I can go with python. Do you have it on github, or do you know someone elses code where this was actually implemented, so I could get a clue how to change the sourcecode of the nodes to work with this? At the moment Iam looking at the "system()" functionallity to "automate" console functionallity.
I'm afraid all the code I am working with is owned by an enterprise and private, but if I am not wrong, this could be an example http://wiki.ros.org/roslaunch/API%20U...
Thanks for the info. I also found out that ros api actually has a shutdown function for the nodes. For some reason I thought that only a master kill will shutdown a node, but of course ctrl-c works on single nodes as well, dont know where this missunderstanding came from. I also found this "node manager" link text ,wich should have lots of helpful code on its github page. Thanks again.