ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Hi,

As far as I know, the only way to change a LaunchConfiguration (e.g. argument value) to a raw Python type is through the opaque function. LaunchConfiguration's can be concatenated to others, or to string, that lead to a new LaunchConfiguration that can be passed to an included launch or to a node (params / remaps / arguments). But as you have seen, it cannot be used as a raw Python type which is necessary when using them in a loop.

You can find here an example of launch argument that is used in a loop through an opaque function. The loop calls another launch files in a given namespace, with some arguments. https://github.com/oKermorgant/anf_launch/blob/main/launch/spawn_all_launch.py

The anf_launch was created for a seminar on ROS 2 launch files and highlights most of the use cases.

Note that it relies on simple_launch (I am the author) to hide all the wrapping around OpaqueFunction.