VS Code ROS

Visual Studio Code 官方文档

visualstudio docs
visualstudio GCC on Linux docs
官方文档主要讲的配置内容是针对GCC/G++程序,不是针对VS Code ROS的,用来参考配置文件参数解析

VS Code 插件 ROS

ROS 插件文档
Attaching to a running ROS Node
Debugging all ROS Nodes in a launch file

launch.json

此文件主要配置debugger settings

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "preLaunchTask": "catkin_make: build",
            "name": "ROS: Launch",
            "type": "ros",
            "request": "launch",
            "target": "/home/ke/Desktop/Controller/ROS-TurtleBot-PID_WS/src/ROS-TurtleBot-PID/control.launch",
        },
    ]
}

此处文件launch.json声明通过.launch文件启动Ros node,预构建任务是生成对应的node
Attach模式调试文档参考:VS Code Attach Debug Mode

task.json

此文件主要是处理compiler build settings

{
	"version": "2.0.0",
	"tasks": 
	[
		{
			"type": "shell",
			"command": "catkin_make -DCMAKE_BUILD_TYPE=Debug",
			"problemMatcher": [
				"$catkin-gcc"
			],
			"group": {
				"kind": "test",
				"isDefault": true
			},
			"label": "catkin_make: build"
		}
	]
}

或者如下形式

{
	"version": "2.0.0",
	"tasks": 
	[
	     {
			"label": "catkin_make",
			"type": "shell",
			"command": "catkin_make",
			"args": [
				"-j4",
				"-DCMAKE_BUILD_TYPE=Release",
				"-DCMAKE_EXPORT_COMPILE_COMMANDS=1",
				"-DCMAKE_CXX_STANDARD=14",
                                //"-DCATKIN_WHITELIST_PACKAGES=lattice_planner"
			],
			"problemMatcher": [
				"$catkin-gcc"
			],
			"group": {
				"kind": "build",
				"isDefault": true
			}
		}	
	]
}

此文件主要是声明launch.jsonpreLaunchTask属性的生成规则,此处定义的是ROS包生成形式
更多task.json参数解析

setting.json

{
    "python.autoComplete.extraPaths": [
        "/home/ke/ros/catkin_ws/devel/lib/python2.7/dist-packages",
        "/opt/ros/kinetic/lib/python2.7/dist-packages"
    ],
    "python.analysis.extraPaths": [
        "/home/ke/ros/catkin_ws/devel/lib/python2.7/dist-packages",
        "/opt/ros/kinetic/lib/python2.7/dist-packages"
    ],
    "cmake.sourceDirectory": "${workspaceFolder}/src/ROS-TurtleBot-PID"
}

通过添加文件/Open Folfer形式打开工作空间,默认生成文件

c_cpp_properities.json

此文件主要配置compiler path and IntelliSense settings

{
  "configurations": [
    {
      "browse": {
        "databaseFilename": "",
        "limitSymbolsToIncludedHeaders": false
      },
      "includePath": [
        "/home/ke/ros/catkin_ws/devel/include/**",
        "/opt/ros/kinetic/include/**",
        "/usr/include/**"
      ],
      "name": "ROS",
      "intelliSenseMode": "gcc-x64",
      "compilerPath": "/usr/bin/gcc",
      "cStandard": "gnu11",
      "cppStandard": "c++14"
    }
  ],
  "version": 4
}

更多c-cpp-properties.json参数解析
ROS IDE: VSCode开发环境的搭建

posted @ 2022-01-25 16:33  采男孩的小蘑菇  阅读(108)  评论(0编辑  收藏  举报