Location of included launch files cannot be determined

Open
#799 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

Reproduce the example with IncludeLaunchDescription, PythonLaunchDescriptionSource, and PathJoinSubstitution, then inspect how the source location is stored and converted. The issue is done when an included launch file built from substitutions can expose its resolved path instead of a Python object representation, while preserving the reported launch-file context.

Written by the indexing model from the issue text.

Description

Bug report

  • Operating System:
    • Ubuntu 22.04
  • Installation type:
    binary
  • Version or commit hash:
    humble, from distro
  • DDS implementation:
  • Client library (if applicable):
Steps to reproduce issue

I'm trying to make a tool for examination of launch file structure and to visualize a tree of included launch files (python).

The following code, where ent is IncludeLaunchDescription object, should output a path to the included launch file, but instead it returns a string that refers to Python object pointer, e.g.<launch.substitutions.path_join_substitution.PathJoinSubstitution object at 0x74b241481780>

if isinstance(ent, IncludeLaunchDescription):
  print(isinstance(ent.launch_description_source.location, str))
  print(ent.launch_description_source.location)

ACTUAL output:

True
<launch.substitutions.path_join_substitution.PathJoinSubstitution object at 0x74b241481780>

EXPECTED output:

True
/home/user/ws/share/...

This should be fixed to enable error reporting for individual launch files included from other launch files. Now it is impossible to automatically determine which launch file has defined a problematic action.

I'm using PAL robotics scripts to build launch files. The function that includes a launch file is:

def include_launch_py_description(
        pkg_name: SomeSubstitutionsType,
        paths: List[SomeSubstitutionsType],
        **kwargs) -> Action:

    pkg_dir = FindPackageShare(pkg_name)
    full_path = PathJoinSubstitution([pkg_dir] + paths)

    return IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            full_path),
        **kwargs)

Also, it looks like IncludeLaunchDescription convert Substitutions into a string <launch.substitutions.path_join_substitution.PathJoinSubstitution object at ...>:

def include_launch_py_description(
        pkg_name: SomeSubstitutionsType,
        paths: List[SomeSubstitutionsType],
        **kwargs) -> Action:

    pkg_dir = FindPackageShare(pkg_name)
    full_path = PathJoinSubstitution([pkg_dir] + paths)
    print(full_path)
    for sub in full_path.substitutions:
        print(sub.describe())

    incl = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            full_path),
        **kwargs)

    print(isinstance(incl.launch_description_source.location, str))
    print(incl.launch_description_source.location)
    return incl

The output:

<launch.substitutions.path_join_substitution.PathJoinSubstitution object at 0x76505beb75e0>
FindPackageShare(pkg='tiago_description')
'launch'
'robot_state_publisher.launch.py'
True
<launch.substitutions.path_join_substitution.PathJoinSubstitution object at 0x76505beb75e0>
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.