Skip to content

Relative PathsΒ #462

@tobiasduerschmid

Description

@tobiasduerschmid

When referencing files in launch files using relative paths, ros-wire throws this erro:


Traceback (most recent call last):
  File "/home/tdurschm/.local/share/virtualenvs/rosdiscover-hw20rvqf/bin/rosdiscover", line 33, in <module>
    sys.exit(load_entry_point('rosdiscover', 'console_scripts', 'rosdiscover')())
  File "/home/tdurschm/rosdiscover/src/rosdiscover/cli.py", line 164, in main
    args.func(args)
  File "/home/tdurschm/rosdiscover/src/rosdiscover/cli.py", line 40, in launch
    summary = _launch_config(args)
  File "/home/tdurschm/rosdiscover/src/rosdiscover/cli.py", line 35, in _launch_config
    return _launch(config)
  File "/home/tdurschm/rosdiscover/src/rosdiscover/cli.py", line 29, in _launch
    interpreter.launch(fn_launch)
  File "/home/tdurschm/rosdiscover/src/rosdiscover/interpreter/interpreter.py", line 59, in launch
    config = reader.read(launch_obj.filename, launch_obj.get_argv())
  File "/home/tdurschm/.local/share/virtualenvs/rosdiscover-hw20rvqf/lib/python3.9/site-packages/roswire/ros1/launch/reader.py", line 546, in read
    ctx, cfg = self._load_tags(ctx, cfg, list(launch))
  File "/home/tdurschm/.local/share/virtualenvs/rosdiscover-hw20rvqf/lib/python3.9/site-packages/roswire/ros1/launch/reader.py", line 162, in _load_tags
    ctx, cfg = loader(self, ctx, cfg, tag)
  File "/home/tdurschm/.local/share/virtualenvs/rosdiscover-hw20rvqf/lib/python3.9/site-packages/roswire/ros1/launch/reader.py", line 128, in wrapped
    return loader(self, ctx, cfg, elem)
  File "/home/tdurschm/.local/share/virtualenvs/rosdiscover-hw20rvqf/lib/python3.9/site-packages/roswire/ros1/launch/reader.py", line 427, in _load_include_tag
    ctx_child, cfg = self._load_tags(ctx_child, cfg, list(launch))
  File "/home/tdurschm/.local/share/virtualenvs/rosdiscover-hw20rvqf/lib/python3.9/site-packages/roswire/ros1/launch/reader.py", line 162, in _load_tags
    ctx, cfg = loader(self, ctx, cfg, tag)
  File "/home/tdurschm/.local/share/virtualenvs/rosdiscover-hw20rvqf/lib/python3.9/site-packages/roswire/ros1/launch/reader.py", line 128, in wrapped
    return loader(self, ctx, cfg, elem)
  File "/home/tdurschm/.local/share/virtualenvs/rosdiscover-hw20rvqf/lib/python3.9/site-packages/roswire/ros1/launch/reader.py", line 203, in _load_param_tag
    value = self._files.read(textfile)
  File "/home/tdurschm/.local/share/virtualenvs/rosdiscover-hw20rvqf/lib/python3.9/site-packages/dockerblade/files.py", line 262, in read
    self.copy_to_host(filename, filename_host_temp)
  File "/home/tdurschm/.local/share/virtualenvs/rosdiscover-hw20rvqf/lib/python3.9/site-packages/dockerblade/files.py", line 131, in copy_to_host
    raise exc.ContainerFileNotFound(path=path_container,
dockerblade.exceptions.ContainerFileNotFound: File not found [./src/.config/model/default.urdf] in container [0e00714cbe957ae2cd3365a30bc06d7f02799c0510913a3091fd5ae1eebc2278]
(rosdiscover) tdurschm@nostromo:~/rosdiscover$

The issue is in https://github.com/ChrisTimperley/roswire/blob/master/src/roswire/ros1/launch/reader.py#L396.
It doesn't convert relative paths into absolute paths.
Immediately after line 399, we should check if the path is relative, and if so, use the launch context to figure out the corresponding absolute path:
https://github.com/ChrisTimperley/roswire/blob/master/src/roswire/ros1/launch/reader.py#L399

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions