Robotics StackExchange | Archived questions

ROS2 debugging with vscode

Hi there,

I've been having trouble debugging ROS2 nodes using vscode's "vscode-ros" extension. I was trying to attach to a already-running python node, but after going to the debugger section and running the "ROS: Attach", in the IDE the view just jumps to my launch.json file and nothing else happens. My setup:

ROS2 version: foxy
Ubuntu version: 20.04.5 LTS
VS Code version: 1.72.2
Extension versions:
ms-iot.vscode-ros@0.8.3
ms-python.python@2022.16.1
ms-python.vscode-pylance@2022.10.20

My launch.json file:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "ROS: Attach",
            "type": "ros",
            "request": "attach"
        },
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": false
        }
    ]
}

Any help would be much appreciated. Thanks!

EDIT:

Just looked at the vs code developer tools console and when trying to run the debugging, I'm getting the following error:

/home/KMR1WZ/.vscode/extensions/ms-python.python-2022.4.1/pythonFiles/lib/python/debugpy --listen localhost:8000 --pid 56224] failed!
    at AttachResolver.<anonymous> (vscode-file://vscode…ers/attach.js:97:28)
    at Generator.throw (<anonymous>)
    at rejected (vscode-file://vscode…vers/attach.js:8:65)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Asked by mike_k on 2022-10-19 02:26:26 UTC

Comments

Answers