ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You could use a combination of the Master API and Slave API to do what you want (first retrieve all registered nodes, iterate over them, compare their names and request the ones you don't want/need any longer to shutdown).

Therefore I want to count the number of ROS_Nodes and kill n-2 nodes. ( My_Node and roscore shall still exist).

Note: I would recommend to do this by name, not "by number". That seems very brittle. Also: roscore is not a node.

You could use a combination of the Master API and Slave API to do what you want (first retrieve all registered nodes, iterate over them, compare their names and request the ones you don't want/need any longer to shutdown).

See #q271776 (among others) for a question that deals with something similar.

Therefore I want to count the number of ROS_Nodes and kill n-2 nodes. ( My_Node and roscore shall still exist).

Note: I would recommend to do this by name, not "by number". That seems very brittle. Also: roscore is not a node.

You could use a combination of the Master API and Slave API to do what you want (first retrieve all registered nodes, iterate over them, compare their names and request the ones you don't want/need any longer to shutdown).

See #q271776 (among others) for a question that deals with something similar.

Therefore I want to count the number of ROS_Nodes and kill n-2 nodes. ( My_Node and roscore shall still exist).

Note: I would recommend to do this by name, not "by number". That seems very brittle. brittle.

Also: roscore is not a node.