Bug when setting launch arguments of included descriptions

Open
#749 3 comments 2 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@methylDragon is already working on this.

Since Dec 26, 2023.

Assessment

This issue has not been assessed yet.

Description

Bug report

Required Info:

  • Operating System:
    • Ubuntu
  • Installation type:
    • Source
  • Version or commit hash:
    • rolling
Steps to reproduce issue

Build this package and run ros2 launch launch_args_ex top.launch.py bottom1:=true bottom2:=true

top.launch.py

import os
from ament_index_python import get_package_share_directory
import launch
from launch.actions import IncludeLaunchDescription

def generate_launch_description():
    return launch.LaunchDescription([
        IncludeLaunchDescription(
            os.path.join(
                get_package_share_directory('launch_args_ex'),
                'launch',
                'bottom.launch.py',
            ),
        ),
    ])

bottom.launch.py

import launch
from launch.actions import DeclareLaunchArgument

def generate_launch_description():
    return launch.LaunchDescription([
        DeclareLaunchArgument("bottom1", description="Inner argument 1"),
        DeclareLaunchArgument("bottom2", description="Inner argument 2"),
    ])
Expected behavior

The bottom1 and bottom2 arguments receive values passed from the command-line.

Actual behavior
❯ ros2 launch launch_args_ex top.launch.py bottom1:=true bottom2:=true                                                                                                                     
[INFO] [launch]: All log files can be found below ...
[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch]: Caught exception in launch (see debug for traceback): Included launch description missing required argument 'bottom1' (description: 'Inner argument 1'), given: []

What's weird is if you don't set one of the args, it now sees that the other one was given:

❯ ros2 launch launch_args_ex top.launch.py bottom2:=true                                                                                                                                                           ─╯
[INFO] [launch]: All log files can be found below ...
[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch]: Caught exception in launch (see debug for traceback): Included launch description missing required argument 'bottom1' (description: 'Inner argument 1'), given: [bottom2]

Here's a full debug output as well:

❯ ros2 launch launch_args_ex top.launch.py bottom1:=true bottom2:=true -d                                                                                                                                          ─╯
[DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.IncludeLaunchDescription'
[INFO] [launch]: All log files can be found below ...
[INFO] [launch]: Default logging verbosity is set to DEBUG
[DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7fe55b1ae700>'
[DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7fe55b1ae700>' ✓ '<launch.event_handlers.on_include_launch_description.OnIncludeLaunchDescription object at 0x7fe55b183f10>'
[DEBUG] [launch]: An exception was raised in an async action/event
[DEBUG] [launch]: Traceback (most recent call last):
  File "/home/josh/ros2_dev/install/launch/lib/python3.8/site-packages/launch/launch_service.py", line 337, in run_async
    raise completed_tasks_exceptions[0]
  File "/home/josh/ros2_dev/install/launch/lib/python3.8/site-packages/launch/launch_service.py", line 230, in _process_one_event
    await self.__process_event(next_event)
  File "/home/josh/ros2_dev/install/launch/lib/python3.8/site-packages/launch/launch_service.py", line 250, in __process_event
    visit_all_entities_and_collect_futures(entity, self.__context))
  File "/home/josh/ros2_dev/install/launch/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
    futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
  File "/home/josh/ros2_dev/install/launch/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
    futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
  File "/home/josh/ros2_dev/install/launch/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
    futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
  [Previous line repeated 1 more time]
  File "/home/josh/ros2_dev/install/launch/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
    sub_entities = entity.visit(context)
  File "/home/josh/ros2_dev/install/launch/lib/python3.8/site-packages/launch/action.py", line 109, in visit
    return self.execute(context)
  File "/home/josh/ros2_dev/install/launch/lib/python3.8/site-packages/launch/actions/include_launch_description.py", line 173, in execute
    raise RuntimeError(
RuntimeError: Included launch description missing required argument 'bottom1' (description: 'Inner argument 1'), given: []

[ERROR] [launch]: Caught exception in launch (see debug for traceback): Included launch description missing required argument 'bottom1' (description: 'Inner argument 1'), given: []
[DEBUG] [launch.launch_context]: emitting event: 'launch.events.Shutdown'
[DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7fe55b183df0>'
[DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7fe55b183df0>' ✓ '<launch.event_handlers.on_shutdown.OnShutdown object at 0x7fe55b183430>'
Dominant language
Python
Stars
156
Forks
200
Avg merge
2d 11h
Merged PRs (30d)
11

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ros2/launch

All issues in ros2/launch

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.