VS code有很多插件可以方便的进行编写代码与调试,而且可以SSH远程调试非常的方便。
linux设备--jetson TX2
Windows10
1.linux上使用静态IP,并且已开启SSH服务
2.linux上创建ROS工作空间,会自动生成build devel
mkdir ros_ws && cd ros_ws
mkdir src && cd src
catkin_init_workspace
cd ../
catkin_make
3.windows上安装VSCode,并点扩展栏安装以下插件
4.windows设备与linux建立远程连接
打开工程后会提示有错误,可以添加与编辑,.json文件
1)c_cpp_properties.json 要手动添加
{
"configurations": [
{
"browse": {
"databaseFilename": "",
"limitSymbolsToIncludedHeaders": true
},
"includePath": [
"/home/tx2/ros_ws/devel/include/**",
"/opt/ros/melodic/include/**",
"/home/tx2/ros_ws/src/beginner_tutorials/include/**",
"/home/tx2/ros_ws/src/zed-ros-interfaces/include/**",
"/usr/include/**"
],
"name": "ROS",
"intelliSenseMode": "gcc-x64",
"compilerPath": "/usr/bin/g++",
"cStandard": "c11",
"cppStandard": "c++11",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
2)launch.json
{
// 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": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}//devel/lib/beginner_tutorials/beginner_tutorials_node",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
}
]
}
3)tasks.json
{
"tasks": [
{
"type": "shell",
"label": "catkin_make",
"command": "catkin_make",
"args": [
"-DCMAKE_EXPORT_COMPILE_COMMANDS=1",
"-DCMAKE_BUILD_TYPE=Release"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always"
},
"problemMatcher": "$msCompile"
}
],
"version": "2.0.0"
}
}
之后就可以Ctrl+F5 Ctrl+Shift+B了,如果没有上面3个文件也可以通过这两个快捷按提示与报错添加