From latest source (git@github.com:ros2/launch.git)
Version or commit hash:
Branch: master
DDS implementation:
N/A
Client library (if applicable):
launch, launch_ros
Steps to reproduce issue
I'm trying to add custom functionality into my launch file(s) that depends on the runtime value of a/few LaunchConfiguration object(s). For example, a yaml_file_path argument:
The aforementioned argument (yaml_file_path) will provide me the path to a yaml file containing a list of entities that I need to then iterate over and "process" in some application-specific way, within the launch code itself. I am not trying to provide these as parameters to a node -- that is not what this question is about.
Since everything in these launch files is essentially an asyncio future, I'm trying to understand how to specify such custom processing within the launch file itself. In my case, this custom processing includes adding an IncludeLaunchDescription instance for each module entry in the yaml file, into a list called module_includes, before returning it from the generate_launch_description() api. For example, the yaml file will contain:
#
# Note, again, that this is *not* for setting node parameters
#
module_a:
prefix: "x/y/z"
...
module_b:
prefix: "a/b/c"
...
how to accept the yaml_file_path into this generate_includes() function?
That is, should I be passing in the LaunchConfiguration object as-is, i.e, yaml_file_path, or some post-processed version of it?
how to use that yaml_file_path value in that function?
That is, since it is an asyncio future, how do I access the resolved (runtime) outcome of that LaunchConfiguration instance within my generate_includes() method, without potentially causing the future to be re-evaluated? I'm afraid of invoking the perform() API on the object since, in a general sense, I wouldn't want to be causing redundant evaluation of the associated future. So, is there any cache that I can lookup for the resolved value of this entity?
And, in a general sense, what if the entity in question was anyLaunchDescriptionEntity object, not just a LaunchConfiguration, and I wanted to obtain its resolved/future value in my OpaqueFunction above?
Some sample code, wherever applicable, would be greatly appreciated.
Bug report
Required Info:
Steps to reproduce issue
I'm trying to add custom functionality into my launch file(s) that depends on the runtime value of a/few LaunchConfiguration object(s). For example, a
yaml_file_path
argument:The aforementioned argument (
yaml_file_path
) will provide me the path to a yaml file containing a list of entities that I need to then iterate over and "process" in some application-specific way, within the launch code itself. I am not trying to provide these as parameters to a node -- that is not what this question is about.Since everything in these launch files is essentially an asyncio future, I'm trying to understand how to specify such custom processing within the launch file itself. In my case, this custom processing includes adding an IncludeLaunchDescription instance for each module entry in the yaml file, into a list called
module_includes
, before returning it from thegenerate_launch_description()
api. For example, the yaml file will contain:The processing I'm trying to implement, is:
Based on reading the code, I understand I need to define and return an OpaqueFunction within my generate_launch_description() method, as below:
... but, I'm not being able to understand:
yaml_file_path
into this generate_includes() function? That is, should I be passing in the LaunchConfiguration object as-is, i.e,yaml_file_path
, or some post-processed version of it?yaml_file_path
value in that function? That is, since it is an asyncio future, how do I access the resolved (runtime) outcome of that LaunchConfiguration instance within my generate_includes() method, without potentially causing the future to be re-evaluated? I'm afraid of invoking theperform()
API on the object since, in a general sense, I wouldn't want to be causing redundant evaluation of the associated future. So, is there any cache that I can lookup for the resolved value of this entity?LaunchDescriptionEntity
object, not just a LaunchConfiguration, and I wanted to obtain its resolved/future value in my OpaqueFunction above?Some sample code, wherever applicable, would be greatly appreciated.