Skip to content

Can't use launch argument for node output #46

Open
@ryanewel

Description

@ryanewel

Bug report

Required Info:

  • Operating System:
    • Ubuntu 18.04
  • Installation type:
    • From apt

Steps to reproduce issue

Using a launch file like:

import launch
import launch_ros.actions

#Argument names
NODE_NAME = "node_name"
OUTPUT = "output"

def generate_launch_description():
  ld = launch.LaunchDescription([
    launch.actions.DeclareLaunchArgument(
      NODE_NAME,
      default_value="node_name",
    ),
    launch.actions.DeclareLaunchArgument(
      OUTPUT,
      default_value="screen"
    ),
 ])
  node = launch_ros.actions.Node(
      package="package_name",
      node_executable="executable_name",
      output=launch.substitutions.LaunchConfiguration(OUTPUT),
      node_name=launch.substitutions.LaunchConfiguration(NODE_NAME),
  )
  ld.add_action(node)
  return ld

Then run:

ros2 launch example_launch.py

Expected behavior

I would expect the output to default to 'screen', but be settable from the cli with output:=log or from another launch file that includes this one.

Actual behavior

Launch fails with message

[ERROR] [launch]: Caught exception in launch (see debug for traceback): <launch.substitutions.launch_configuration.LaunchConfiguration object at 0x7f5f04242ac8> is not a valid output configuration

Additional information


Feature request

Feature description

Implementation considerations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions