I'm trying to shut down all Nodes except 1 within a C++ program. Therefore I want to count the number of ROS_Nodes and kill n-2 nodes. ( My_Node and roscore shall still exist). Or is there any other way to do so?
Thanks for your Help
Originally posted by bambucha on ROS Answers with karma: 3 on 2018-04-16
Post score: 0
Original comments
Comment by gvdhoorn on 2018-04-16:
To avoid an xy-problem, it might be good if you could clarify why you want to do this. It might not be necessary.
Comment by bambucha on 2018-04-16:
I need it, because I have to restart Gazebo with another enviroment. But the Linux-Computer is remote controlled to this. Therefore I have to shut down every ROS_Node, except the one which handles the remote.
Comment by gvdhoorn on 2018-04-16:
If you can manage the state of "your node", then would deployment using Docker perhaps be an option? Reusing roscore
instances is not necessarily always very stable (left over parameters, etc).