ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Rapid Node Connecting/Disconnecting

asked 2012-06-28 06:16:33 -0500

PerkinsJames gravatar image

A project I am working on needs the ability to rapidly create/connect and disconnect nodes from ROS. This could happen on the order of 20 nodes created and then destroyed in 15 seconds, all requesting data from other publishing nodes or through services. This would happen at random times throughout the run time of the robot.

I am assuming that ROS was not designed with this in mind, but I was wondering if anyone knew what behavior ROS would exhibit? e.g. significant latency in the transport due to overhead of connecting, etc.

Thanks a lot!

edit retag flag offensive close merge delete


hello, I just wondered if you may use timers to subscribe topics then retrieve data then disable the timer ? but i guess you want much more complicated stuff than that

cagatay gravatar image cagatay  ( 2012-06-28 06:29:26 -0500 )edit

Can you provide more information on why you need to do this? It's possible that there is a more ROS-like way to achieve whatever you're looking for.

lindzey gravatar image lindzey  ( 2012-06-28 08:20:43 -0500 )edit

There are possibly other ways of doing it that we have been investigating. The issue here is that we have an existing code base that we would like to connect to ROS, but that would include this rapid connecting issue unless we make major modifications.

PerkinsJames gravatar image PerkinsJames  ( 2012-06-28 09:17:34 -0500 )edit

@joq, I figured that this would be an issue and not in the design. You say there is long timeout after a node has left (which is ok), but what about connecting? Or are these two things interrelated in their effect on they system? Due to my job, I'm not able to give application details. Thanks.

PerkinsJames gravatar image PerkinsJames  ( 2012-06-28 10:21:36 -0500 )edit

Connecting nodes and subscribing to topics is not fast. I would encourage you to consider connecting each node as it starts. Use a topic or service to activate or deactivate them.

joq gravatar image joq  ( 2012-07-12 04:23:41 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2012-06-28 09:22:35 -0500

joq gravatar image

updated 2012-06-28 09:26:00 -0500

ROS is definitely not designed to work that way. Specifically, the current implementation requires long timeouts before discovering that a node has left the graph.

The usual ROS approach is for all nodes to run continuously. They may become active or inactive due to messages they receive.

I doubt your approach is really a good idea. What problems are you trying to solve that way?

edit flag offensive delete link more

answered 2012-07-11 18:05:46 -0500

tfoote gravatar image

If you're using services you can leverage the waitForService method. This will cause the mode to wait for the service to have been communicated before you try to call it.

The nodes will take a few seconds to connect so as long as you can spin up and down these 20 nodes in parallel in the 15 seconds it should work.

Your other option is to have a persistent node and communicate with it directly from your starting and stopping nodes.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-06-28 06:16:33 -0500

Seen: 416 times

Last updated: Jul 11 '12