VScode调试ros代码
https://blog.csdn.net/u012254599/article/details/106143540
https://blog.csdn.net/weixin_42268975/article/details/106021808
VScode.
https://blog.csdn.net/ABC_ORANGE/article/details/102665792
https://blog.csdn.net/hello_crayon/article/details/40350291
https://blog.csdn.net/hello_crayon/article/details/40350291
参考链接:
https://blog.csdn.net/Kalenee/article/details/103828448
- 新建configuration设置. 通过添加配置,在.vscode的launch.josn中添加ROS: Attach
- 编译程序(生成类型必须为RelWithDebInfo)。在
CMakeLists.txt中,project后添加参数SET(CMAKE_BUILD_TYPE RelWithDebInfo) - 通过按
Ctrl + Shift + P,输入>ros::run运行节点程序(也可以手动运行,需要加载环境) - 运行ROS:Attach,选择运行程序(选择c++/python,及节点名称)进入断点调试模式。可能有个需要有个确认及授权。
我在这里运行时,还是会出现’poll failed with error Interrupted system call’,但是不影响调试。
另外就是,我这里变量显示的不太正常。但上面那种方式就没问题。
注意,使用这种方法,就不需要launch.json的配置了。
https://blog.csdn.net/Kalenee/article/details/103828448
- 创建launch文件,调用调试的节点
- 在.vscode的launch.josn添加ROS: Launch,(Gdb下拉框添加配置,ROS:Launch自动在launch.josn文件中生成),"target"设置为launch文件的绝对路径。可右键launch文件,获得其文件路径。
- 运行ROS:Launch,选择运行程序进入断点调试模式
另外,查到一个比较官方的方法介绍,有兴趣的可以看一下:
http://www.lib4dev.in/info/MrGnomes/VS_Code_ROS/186882206#3-intellisense
其中还对c_cpp_properties.json里的includePath做了介绍。