在Settings->Plugin中搜索ROS,然后安装ROS Support, Robot Framework Support, Hatchery, 然后重启IDE
如果有rospy文件,还要设置Build, Execution, Deployment->Python Interpreter, 选System Interpreter中的Python2.7
再设置Cmake,
在Settings->Build,Execution,Deployment->CMake
CMake options: -DCATKIN_DEVEL_PREFIX:PATH=~/catkin_ws_clion/devel (写你的项目路径)
Build directory: ~/catkin_ws_clion/build
这些都搞定以后,在terminal中source ./devel/setup.bash
之后,在同一窗口启动clion
clion中,File->open, 选CMakeLists.txt,然后open as project
打开之后,在Clion下面的terminal中把节点launch起来
在Run -> Attach to Process中选择想要debug的节点
程序中可打断点
然后在想昆虫一样的debug按钮旁边的combo box中选择节点,点debug
如果cpp程序进入不了断点,要修改一下CMakeLists.txt,
加上下面一句
set(CMAKE_BUILD_TYPE "Debug")
然后在clion的CMake options里面加上
-DCMAKE_BUILD_TYPE=Debug