ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Hi, I find a method to debug a C++ node usign VSCode on ROS2 Foxy (Ubuntu). Have a look and told me if it work for you.
https://gist.github.com/JADC362/a4425c2d05cdaadaaa71b697b674425f
2 | No.2 Revision |
Hi, I find a method to debug a C++ node usign VSCode on ROS2 Foxy (Ubuntu). Have a look and told me if it work works for you.
https://gist.github.com/JADC362/a4425c2d05cdaadaaa71b697b674425f
3 | No.3 Revision |
Hi, I find a method to debug a C++ node usign VSCode on ROS2 Foxy (Ubuntu). Have a look
1) Compile your C++ package with the symbols:
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo
2) Run the GDB Server in a localhost:port
ros2 run --prefix 'gdbserver localhost:3000' package_name executable_name
3) Open VSCode on your workspace, open the debug section (side bar) and told me if it works create new launch.json configuration file for you.
debugging. Configure as follow:
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Debugger",
"request": "launch",
"type": "cppdbg",
"miDebuggerServerAddress": "localhost:3000",
"cwd": "/",
"program": "[build-path-executable]"
}
]
}
Change [build-path-executable] by your executable build file. You can find this path on the console when you launch the server.
4) Run the debugger and use VSCode to debug your code.
Here is a more detail explanation https://gist.github.com/JADC362/a4425c2d05cdaadaaa71b697b674425f