[poll] Interest in ros2 launch action to support for-loops (e.g. IncludeNLaunchDescriptions())?

Would there be interest in a launch Action that could support for loop like functionality?

I was working with a simulated swarm of robots a while back where I wanted to be able to change the number of robots being spawned from the commandline (e.g. by setting n_robots:=10). There are a few workarounds, for my particular use case (see the discussion here [ros2/launch#499]), with the cleanest probably being the use of OpaqueFunction as suggested by @wjwwood. But there is certainly room for improvement, in terms of readability of code, and such a feature could potentially merit its own action (e.g.:

class IncludeNLaunchDescription(Action):
    def __init__(self, ..., n_launch_arguments):
        # ...

)

I am curious if there are any others that would get any use out of loop-style launch actions, to better justify whether its worth adding loop support.

4 Likes

I would definitely use something like this.

Definitely woudl be useful for me. Specific use-case would be specifying a string of PointCloud2 topic names, and for each topic name spinning up a dedicated filter pipeline to apply a series of PCL filters. Right now I don’t know if this is even possible to do in a launch file. You sort of have to hard-code the vector of strings, you can’t pass them in…

I would use this as well. I frequently resort to the OpaqueFunction workaround for launching multiple robots in a simulated environment. This would be much nicer.

Good timing, guys. The answer to your issue has been posted a few days back: Rosetta_launch - Everything I Know About ROS 1 and ROS 2 launch files - #7 by DLu

1 Like