Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location of included launch files cannot be determined #799

Open
dseredyn opened this issue Sep 28, 2024 · 0 comments
Open

Location of included launch files cannot be determined #799

dseredyn opened this issue Sep 28, 2024 · 0 comments

Comments

@dseredyn
Copy link

dseredyn commented Sep 28, 2024

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant