在VSCode中编辑 .json 文件,调试ROS节点。

2019-06-17  本文已影响0人  钢铁侠与小辣椒

I am a totally fresh man to ROS and cpp Programming. If you have any recommendations and further requires to the contents. Please do not hesitate to leave your comments. 

HELP EACH OTHER TO GET IMPROVEMENTS IS THE BEST THING WE CAN DO!

Open the VSCode at the base path. The base path is the path to run catkin_make.

Run the following command in the base path to create "c_cpp_properties.json", which will be placed at the directory of .vscode/. And simultaneously "compile_commands.json" will be created and placed at the directory of build/.

catkin_make -DCMAKE_EXPORT_COMPILE_COMMANDS=Yes

Edit "c_cpp_properties.json". Normally, we only need to modify “includePath”: and “compileCommands”:

c_cpp_properties.jason

VSCode doesn’t have "make" function. Therefore, the "Task" function is used to set up configurations. Use “Ctrl+shift+P” to enter command mode. Select “Tasks: Configure Tasks”. Select “catkin: make”. In .vscode/, a task.jason file will be auto-generated.

task.jason

To build the node, press “Ctrl + Shift + B”. The process of building the node can be observed in the panel of TERMINAL.

processing a node

Click the Debug icon lists on the Activity Bar, and then select “Add Configurations”. Inside the drop-down window, select “C++(GDB/LLDB)”. A “launch.json” file is generated automatically. Edit the file as below.

launch.jason
上一篇下一篇

猜你喜欢

热点阅读