Location of included launch files cannot be determined
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>
@wjwwood can you take a look about this?