Shutdown nodes from within a ROS node
This is a follow up question to Shutdown system (computer) with a ROS node.
Since the system in which the ROS is running is connected to some motors I would like to know if it is possible to close nodes from within a different ROS node.
Since the system is powered by some batteries, the shutdown procedure I would like to achieve is something like this: Once battery level is below a certain threshold:
- Close/stop all nodes
- Stop rosbag recording
- Shutdown system
However I have no clue how to "Close/stop all nodes" and "Stop rosbag recording" from within a certain node (The same node used to check the battery level).
Is this possible?