VS_Code_ROS icon indicating copy to clipboard operation
VS_Code_ROS copied to clipboard

Debug nodelets (insted of nodes)

Open Ivancaminal72 opened this issue 3 years ago • 1 comments

Hi,

In my current project I am using nodelets instead of nodes due to the fast communication properties when working with heavy data such as pointclouds. I would like to know if there is a way to debug these nodelets. I tried to put directly the nodelet libraries created under devel/lib/workspace/ in the lanunch.json file, but is not working. I suspect I should put instead the executable files that load those libraries but I don't know where are they placed. Could you show some help solving this?

BTW, I've found this repo very useful and well explained, thanks for this contribution!

Ivancaminal72 avatar Sep 03 '21 16:09 Ivancaminal72

Hi, thanks for the praise :)

I never used nodelets, but as far as I understand it, it uses a nodelet manager to start the induvidual nodes. I have no example, but I guess you need to set the nodelet manager as the program that should be debugged inside the .launchfile, and then use the "args" variable to set your nodelet library. Here is an example:

 {
                "name": "My_Nodelet_Debugging",
                "type": "cppdbg",
                "request": "launch",
                "program": "/opt/ros/noetic/lib/nodelet/nodelet", <-- chane noeltic to your ros distribution
                "args":  ["standalone", "${workspaceFolder}/../../devel/lib/myNode/"],  <-- set path to your nodelet
                "stopAtEntry": false,
                "cwd": "${workspaceFolder}/../../",
                "environment": [],
                "externalConsole": false,
                "MIMode": "gdb",
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ]
            },
}

I also found this issue here that also seems to be related: https://github.com/vadimcn/vscode-lldb/issues/23

And you need to build your nodelet library with debugging flags.

Hope it helps

lzptr avatar Sep 25 '21 13:09 lzptr