How to re-load nodelets in a running roscore without triggering bugs?

asked 2019-12-02 10:35:21 -0600

tompe17 gravatar image

updated 2019-12-04 09:19:14 -0600

I am loading a lot of nodelets from a launch file. This works perfectly if I let the launch file start roscore.

But if I start roscore in a seperate window and start the launch file it works the first time. But killing the running launch file with Ctrl-c and restarting it will give me one or more nodes killed during startup with the message "new node registered with same name".

rosnode list

does not show me any remaining nodes (except log) after killing the launch file. And I cannot fins any hanging processes. And rosnode cleanup did not help.

So do anybody have a workaround? Or a pointer to where I can either start debugging or if this bug is well know some place where its is discussed. Found one issue in github but that was nodes remaining and visible with rosnode list so not exactly the same.

I am including the launchfile bellow (launchbug2,launch) that only uses standard ROS. Running it on an old laptop I do not see the issud. Running it on my faster and newer computer it took three restarts to trigger the issue, So run roscore in one shell. Then in another shell start with "roslaunch lrs_launch launchbug2.launch".

Launch file:

<launch>
  <group ns="/uav0">
    <node pkg="nodelet" type="nodelet" name="execmanager"  args="manager _num_worker_threads:=34"/>

    <node pkg="nodelet" type="nodelet" name="plus00" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus01" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus02" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus03" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus04" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus05" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus06" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus07" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus08" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus09" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus10" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus11" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus12" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus13" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus14" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus15" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet" type="nodelet" name="plus16" args="load nodelet_tutorial_math/Plus execmanager _value:=1.1"/>
    <node pkg="nodelet ...
(more)
edit retag flag offensive close merge delete

Comments

It sounds like you might have multiple nodes in your launch file with the same name. Can you edit your question to include your launch file?

ahendrix gravatar imageahendrix ( 2019-12-02 22:06:43 -0600 )edit

Well, there are nodes and nodelets with the same name but they are in different namespace. And it works perfectly the first time. I mostly see the issue with nodelets but I think I saw it with an ordinary node also. I load much more nodelets than ordinary nodes.

I am trying now to create a launchfile only using standard ROS things that triggers the problem.

tompe17 gravatar imagetompe17 ( 2019-12-03 05:58:40 -0600 )edit

Have now included a launchfile that triggers the problem.

tompe17 gravatar imagetompe17 ( 2019-12-03 06:57:19 -0600 )edit

It fails in registrations.py (in ros_comm) because the port numbers for the API are different:

('caller_id:', '/uav9/plus18', 'http://terra8:37185/', 'http://terra8:44603/')

44603 is from creation of the node. And 37185 is the input API.

tompe17 gravatar imagetompe17 ( 2019-12-03 08:04:14 -0600 )edit