ms-iot / vscode-ros

Visual Studio Code extension for Robot Operating System (ROS) development
https://marketplace.visualstudio.com/items?itemName=ms-iot.vscode-ros
MIT License
410 stars 95 forks source link

[feature request] Launch request should support relative path #692

Open wanghuohuo0716 opened 2 years ago

wanghuohuo0716 commented 2 years ago

(Please add appropriate labels)

\<Version of the plugin> ROS-plugin version: v0.8.2

\<Copy the Version information from the Help | About menu> vscode version

Version: 1.65.2
Commit: c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1
Date: 2022-03-10T15:36:26.048Z (6 days ago)
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Linux x64 4.15.0-99-generic

what is the bug

when I debug the ros launch file,error report "Launch request requires an absolute path as target"

Repro steps

1.mkdir -p catkin_key_board/src 2.cd catkin_key_board/src 3.git clone https://github.com/wanghuohuo0716/key_board.git 4.cd .. 5.catkin_make -DCMAKE_EXPORT_COMPILE_COMMANDS=Yes 6.code . 7.modify c_cpp_properties.json

{
    "configurations": [
        {
            "browse": {
                "databaseFilename": "",
                "limitSymbolsToIncludedHeaders": true
            },
            "includePath": [
                "/opt/ros/kinetic/include",
                "/usr/include"
            ],
            "name": "ROS",
            "intelliSenseMode": "linux-gcc-x64",
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "gnu11",
            "cppStandard": "gnu++11",
            "compileCommands": "/home/wanghuohuo/catkin_key_board/build/compile_commands.json"
        }
    ],
    "version": 4
}

8.add task.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "catkin_make",
            "args": [
                "--directory",
                "/home/wanghuohuo/catkin_key_board",
                                "-DCMAKE_BUILD_TYPE=RelWithDebInfo",
                "-DCMAKE_BUILD_TYPE=Debug"
            ],
            "problemMatcher": [
                "$catkin-gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "label": "catkin_make: build"
        },

    ]
}

9.add launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "ROS: Attach",
            "request": "attach",
            "target": "/home/wanghuohuo/catkin_key_board/devel/lib/keyboard/keyboard_node",
            "type": "ros"
        }
    ]
}

10.settings.json

{
    "python.autoComplete.extraPaths": [
        "/opt/ros/kinetic/lib/python2.7/dist-packages"
    ],
    "python.analysis.extraPaths": [
        "/opt/ros/kinetic/lib/python2.7/dist-packages"
    ]
}

11 run vscode debug button, chose ROS:Attach,run it launch command: rosrun Package:key_board Executable: key_board_node

  1. error occured!!!!!!!!!!!!!!!!

2022-03-17 22-25-58屏幕截图

expected behavior

get into debug mode

wanghuohuo0716 commented 2 years ago

anyone can help me?