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

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”:

在VSCode中编辑 .json 文件,调试ROS节点。_第1张图片
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.


在VSCode中编辑 .json 文件,调试ROS节点。_第2张图片
task.jason

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


在VSCode中编辑 .json 文件,调试ROS节点。_第3张图片
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.


在VSCode中编辑 .json 文件,调试ROS节点。_第4张图片
launch.jason

你可能感兴趣的:(在VSCode中编辑 .json 文件,调试ROS节点。)