Reputation: 23
Is it possible to start three nodes A, B, and C at the same time, stop only A in the middle, and then restart the stopped A? I'm wondering if the stop and restart triggers can be dynamically changed using dynamic reconfigure, but I don't know how to stop and restart the node. I use the ROS melodic. Thanks!
Upvotes: 2
Views: 5929
Reputation: 760
You can launch all three nodes using ROS Launch.
In case if you want any node to restart then you can use
respawn="true"
For example; launch file:
<roslaunch>
<node name="foo" pkg="package" type="node" respawn="true" />
</roslaunch>
You can read more about it in the following links:
http://wiki.ros.org/roslaunch/XML/node
In case if you want the code to start and restart on runtime, then you can also subscribe to a specific topic and accordingly, you can send the data on that topic to start/stop/restart the node and the node can simply perform that action in a separate thread.
Upvotes: 2
Reputation: 131
ROS is intended for all nodes to run continuously until shutdown. Nevertheless there are some ideas that may help you to find a workaround:
Upvotes: 1