How to correctly respawn a nodelet manager
I have a bringup launch file to start my robot and all its components. For the 3d sensors I start a nodelet manager that will load the sensor drivers in a nodelet for each sensor. For normal nodes, if I wanted to change something I just reload the parameters I need or change something in my code then compile and kill the node which was started with a "respawn" flag. Is there a way to do that for a nodelet_manager so that it restarts and reloads the nodelets it previously had before killing?
The only way that comes to my mind now is to create a python node that does a system call to call roslaunch. And the roslaunch it calls will start a nodelet manager and load all the needed nodelets. If this node is killed it will kill the nodelet manager before quitting and then be automatically respawn thus recalling the same roslaunch again. I need this to avoid having to restart the whole bringup whenever I change one node.
Asked by Mehdi. on 2016-09-28 06:36:02 UTC
Answers
As it's said here: https://answers.ros.org/question/51474/can-i-run-a-bash-script-using-roslaunch/?answer=157051#post-id-157051 , better late than never...
Instead of python node, it's possible to add an executable script to some package like:
#!/bin/bash -eu
roslaunch "$@"
And then run it from roslaunch:
<node pkg="some_pkg" type="script_name" name="my_launch"
respawn="true" output="screen"
args="$(find some_pkg)/launch/nodelets.launch"/>
Here nodelets.launch
contains all nodelet related stuff.
Also, there should be required
parameter in nodelet manager, so it could finish on crash:
<node pkg="nodelet" type="nodelet" name="manager"
required="true" output="screen" args="manager"/>
Asked by _andrei_ on 2021-10-31 23:47:43 UTC
Comments