Home > Back-end >  Vscode-ROS not attaching
Vscode-ROS not attaching

Time:10-21

When trying to debug Python nodes, I can't get Vscode-ROS to attach to a running node.

I did what is suggested here: https://github.com/ms-iot/vscode-ros/blob/master/doc/debug-support.md

  • Start roscore in one terminal
  • Start my node in another terminal via rosrun beginner_tutorials talker.py (just the publisher from this tutorial: http://wiki.ros.org/ROS/Tutorials/ExaminingPublisherSubscriber)
  • Select a break point in the file I want to debug
  • Create a simple launch configuration in VSCode and run it

Then, nothing more happens. I've also set the -DCMAKE_BUILD_TYPE=Debug flag when building with catkin_make, but I assume that's just for C ?

CodePudding user response:

While you can use the ROS: attach command from the command pallet (ctrl-shift-p), "F5" debugging in VSCode ROS extension is designed to work with ROS launch files.

Here's a video on how to work with VSCode ROS extension and Python - https://www.youtube.com/watch?v=A6ABRdL0ckg&list=PL2dJBq8ig-vihvDVw-D5zAYOArTMIX0FA&index=6.

Hope that helps!

CodePudding user response:

I had the same issue, so I was forced to use a "launch" request.

    {
        "name": "ROS: some_node",
        "type": "ros",
        "request": "launch",
        "target": "/path/to/launch/file"
    },

I know this is not convenient, but if you can write your nodes in a way that can be started and stopped at any moment, you should be OK with this approach.

On the other hand, attaching the C node is working fine.

  • Related