Skip to content

Substitutions not expanding in arguments to Node #512

@dg-huawei

Description

@dg-huawei

This may just be user error, but I don't seem to be able to use substitutions in the 'arguments' field of the Node action. This is what I was trying (which didn't work):

service_bridge = Node(
    package="ros_gz_bridge",
    executable="parameter_bridge",
    arguments=[PathJoinSubstitution(["/world/", LaunchConfiguration("world"), "/control@ros_gz_interfaces/srv/ControlWorld"])],
    parameters=[
        {
            'use_sim_time': True,                
        }
    ],
)

Mean while hard-coding the path works fine:

service_bridge = Node(
    package="ros_gz_bridge",
    executable="parameter_bridge",
    arguments=["/world/store/control@ros_gz_interfaces/srv/ControlWorld"],
    parameters=[
        {
            'use_sim_time': True,                
        }
    ],
)

as does using an opaque function to do the substitution manually in python:

def opaque_function(context):
    
    world = LaunchConfiguration("world").perform(context)
    service_bridge = Node(
        package="ros_gz_bridge",
        executable="parameter_bridge",
        arguments=["/world/" + world + "/control@ros_gz_interfaces/srv/ControlWorld"],
        parameters=[
            {
                'use_sim_time': True,                
            }
        ],
    )
    
    return [service_bridge]

opaque_nodes = [OpaqueFunction(function=opaque_function)]

The documentation seems to suggest that a list of iterables or substitutions should be supported so I would expect this to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions