Robotics StackExchange | Archived questions

Configure X number of nodes in .launch

May be an FAQ but I'm re-posting a question with a result of my bit of research.

I have an application where there's a ROS node that we want to spawn X number of.

Is there a software solution?

Here's what I've found:

Asked by 130s on 2021-01-07 12:26:42 UTC

Comments

I'm not sure this is something you should do, but see #q353817 (and the Q&A you already found) for an example on how to implement recursion within .launch files.

Reason I'm hesitant about these kinds of things is because I believe .launch files are not meant for this.

In my opinion .launch files are part of the configuration of your application, and should probably not contain all sorts of constructs which require (runtime) interpretation of a Turing complete language. Declarative languages have the advantage of being more parseable, which makes analysis possible. If you start adding imperative concepts, that goes away, which is really annoying.

If you want "dynamic .launch files", use a higher-level entity to generate those, such as the Python package linked in #q368557. This generates .launch files. Iteration is fully supported there.

Asked by gvdhoorn on 2021-01-07 13:32:55 UTC

While I 100% agree with ".launch files are part of the configuration of your application" (it's just an input file of an executable roslaunch), I'm not sure if I fully understood your concern. I do agree if you're saying there should be static files (or any form) that define the state of app (by dynamically defining some configs that would be impossible). That said, one thing to clarify about the usecase my team has in mind is that we intend to have static files that are to be passed the process X (and this process X is what I'm looking for in this thread).

Asked by 130s on 2021-01-12 13:43:59 UTC

Answers