Ask Your Question

Is there a package for management to control the start order of nodes? [closed]

asked 2018-07-13 08:45:27 -0500

updated 2018-07-17 01:47:53 -0500

Hello, experts.
This question is the following this link

I wanted to manage the start order of nodes I developed.
Is there a package for management to control the start(initialization) order of nodes?
Would you tell me information about that's packages or tools?

Let's imagine there are many nodes which have dependency of the start moment of others.
For example, the start order of "B" node have dependency on the start order of "A" node. This mean is that "B" node can start to initialize for itself after receiving a signal which "A" node will send to "B" node.
When "A" node is initializing, It may be that we want to stop the progress of initializing the "B" node by a signal like initialization fail.

For a small number of nodes, we just add some code for check that.
We can use a topic named /start or We can use a service and client.
But, for many number of nodes, we have to add similar code in many times.
Patently , It is a duplicate work.
And, when we want to change it's construction about the order, we will have a burden.

Is there a package or tool to help this problem solve easily?
If there is no that, maybe I'll make it.

// On this description, "initialization" of nodes is not "initialization" of linux's process.
// It is the initialization, in your code, as dynamic memory allocation, instance initialization.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by harderthan
close date 2019-01-31 08:12:01.718907


You can use the bash script to sequentially start the nodes in the order you need

0xd1ma gravatar image0xd1ma ( 2018-07-15 08:53:38 -0500 )edit

@0xd1ma . Thank you for a comment.

Yes, right. If we use the bash script to sequentially, then it will start the nodes in the order I need. But, exactly I want to control the order of initialization progress in node code.

harderthan gravatar imageharderthan ( 2018-07-15 19:25:47 -0500 )edit

@0xd1ma .

Please think about this. Despite that "A" node started first, "A" node will be albe to finish more late than others.

harderthan gravatar imageharderthan ( 2018-07-15 19:26:07 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2018-07-16 03:15:32 -0500

Choco93 gravatar image

I had a similar problem, as I needed some topics from node 1 first, so node 2 could use them. I used delay as described here link.

edit flag offensive delete link more


Please check upper comments on my topic. exactly I want to control the order of initialization progress in node code.

harderthan gravatar imageharderthan ( 2018-07-16 23:24:49 -0500 )edit

The link I shared can be used to initialize nodes in order by adding delay in them. You can call service to launch second node when condition of second node is met.

Choco93 gravatar imageChoco93 ( 2018-07-17 01:41:30 -0500 )edit

You can also modify the shell script so instead of delay, it would check if certain topic has data in it, and if it has, then launch second node.

Choco93 gravatar imageChoco93 ( 2018-07-17 01:43:06 -0500 )edit

answered 2018-07-13 11:05:06 -0500

AndyZe gravatar image

updated 2018-07-14 18:28:19 -0500

I don't have a satisfactory answer for controlling the node launch order. ROS1 wasn't really intended to be used that way.

A better ROS1 approach would be to launch a bunch of servers or action servers simultaneously. A state machine could be used to manage the way each node reacts to error signals (e.g. shut down node B if node A emits X error msg). Two ROS packages for that are FlexBE and SMACH. FlexBE sounds a bit more sophisticated because you can update it on the fly.

edit flag offensive delete link more


Could you maybe be a bit more specific and point to the relevant part of the docu?

NEngelhard gravatar imageNEngelhard ( 2018-07-14 01:26:16 -0500 )edit

I don't see how FlexBE can help with the OP's question?

PeteBlackerThe3rd gravatar imagePeteBlackerThe3rd ( 2018-07-14 05:18:13 -0500 )edit

If you take the narrow view of "how do you run nodes in a specific order" it's not the right answer.

To the bigger question of how do you reconfigure and trigger things without lots of repetitive code, it seems like a good answer.

AndyZe gravatar imageAndyZe ( 2018-07-14 14:11:41 -0500 )edit

So it's simply not the right answer to this question?

NEngelhard gravatar imageNEngelhard ( 2018-07-14 14:31:50 -0500 )edit

There's not a satisfactory solution to launching nodes in order because ROS1 wasn't designed like that. It looks like FlexBE gives equivalent functionality, though. SMACH would probably work, too.

AndyZe gravatar imageAndyZe ( 2018-07-14 15:48:01 -0500 )edit

FlexBE and SMACH only care about execution, not about how the nodes are started, so your answer simply is incorrect.

NEngelhard gravatar imageNEngelhard ( 2018-07-14 15:55:28 -0500 )edit

@NEngelhard feeling pedantic today, huh?

I hope you give a better suggestion.

AndyZe gravatar imageAndyZe ( 2018-07-14 15:59:06 -0500 )edit

The question was specifically about organizing the start sequence of several nodes. How can FlexBE/SMASH help if your system does not start e.g. due to deadlocks while launching?

NEngelhard gravatar imageNEngelhard ( 2018-07-14 16:08:38 -0500 )edit

Question Tools

1 follower


Asked: 2018-07-13 08:45:27 -0500

Seen: 236 times

Last updated: Jul 17 '18