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

How to correctly respawn a nodelet manager

asked 2016-09-28 06:36:02 -0500

Mehdi. gravatar image

updated 2016-09-28 06:52:48 -0500

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-10-31 23:47:43 -0500

_andrei_ gravatar image

As it's said here: https://answers.ros.org/question/5147... , 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"/>
edit flag offensive delete link more

Question Tools

4 followers

Stats

Asked: 2016-09-28 06:36:02 -0500

Seen: 1,105 times

Last updated: Oct 31 '21