vscode-ros: [bug] ROS1 packages aren't found anymore when using vscode's ROS debugger type (launch file)

(Please add appropriate labels)

  • Windows: (Version)
  • Linux: (Ubuntu 20.04 in container in WSL2)
  • ROS 1: noetic
  • ROS 2: Dist

Extension: 0.9.1

vscode: Version: 1.76.2 (user setup) Commit: ee2b180d582a7f601fa6ecfdad8d9fd269ab1884 Date: 2023-03-14T17:55:54.936Z (2 wks ago) Electron: 19.1.11 Chromium: 102.0.5005.196 Node.js: 16.14.2 V8: 10.2.154.26-electron.0 OS: Windows_NT x64 10.0.22621 Sandboxed: Yes

what is the bug

When launching a ROS1 debug session with a launch file, packages within the workspaces aren’t found.

Here the full error message:

Command failed: roslaunch --args /foo /workspace/src/foo/launch/foo.launch 
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/node_args.py", line 264, in create_local_process_args
    matches = roslib.packages.find_node(node.package, node.type, rospack=rospack)
  File "/opt/ros/noetic/lib/python3/dist-packages/roslib/packages.py", line 417, in find_node
    return find_resource(pkg, node_type, filter_fn=_executable_filter, rospack=rospack)
  File "/opt/ros/noetic/lib/python3/dist-packages/roslib/packages.py", line 519, in find_resource
    pkg_path = rospack.get_path(pkg)
  File "/usr/lib/python3/dist-packages/rospkg/rospack.py", line 207, in get_path
    raise ResourceNotFound(name, ros_paths=self._ros_paths)
rospkg.common.ResourceNotFound: foo
ROS path [0]=/opt/ros/noetic/share/ros
ROS path [1]=/opt/ros/noetic/share

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/__init__.py", line 268, in main
    node_args.print_node_args(options.node_args, args)
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/node_args.py", line 108, in print_node_args
    args = get_node_args(node_name, roslaunch_files)
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/node_args.py", line 194, in get_node_args
    args = create_local_process_args(node, machine)
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/node_args.py", line 267, in create_local_process_args
    raise NodeParamsException(str(e))
roslaunch.node_args.NodeParamsException: foo
ROS path [0]=/opt/ros/noetic/share/ros
ROS path [1]=/opt/ros/noetic/share

Repro steps

  1. Check-out https://github.com/rsarrazin2/catkin_workspace_for_vscode_ros_extension.
  2. Start vscode and reopen in devcontainer. (The image build takes ~5 minutes on my system.)
  3. Build with catkin build foo.
  4. Go to the debug activity and launch the “foo_node” configuration.

expected behavior

The foo package is found and can be debugged.

additional context

  • Reverting to extension version 0.9.0 doesn’t solve the problem.
  • Reverting to extension version 0.8.4 solves the problem.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (12 by maintainers)

Most upvoted comments

Could you install this and try it out to ensure it works for your scenario? From the CI server- https://github.com/ms-iot/vscode-ros/suites/11925034188/artifacts/624651657

I’ve had a hard time creating a minimum viable devcontainer that reproduces the error. Especially as vscode / extensions modify .vscode/c_cpp_properties.json and .vscode/settings.json. I’ve tried to reduce the image generation time to a maximum but it still takes several minutes on my system.

Please note also that I’m running vscode on Windows that’s connected to a WSL2 Ubuntu 20.04. The devcontainer runs in docker natively installed on the WSL2 Linux, i.e. I don’t use Docker Desktop for Windows with its WSL2 backend. It shouldn’t matter but I prefer to mention that.

I hope this environment makes it possible on your side to reproduce the issue. From the message error it looks like the ROS debugger 0.9.1 doesn’t source ./devel/setup.bash, but it’s a pure interpretation of mine.

If there’s some extension debug mode I can / shall activate if you can’t reproduce on your side, don’t hesitate to tell me, I’ll try to be as reactive as you!

If you are blocked by this, you can roll back to 0.8.4 while I investigate.