1. 安裝gcc
sudo apt-get build-dep gcc sudo apt-get install build-essential
2. 安裝Kdevelop
sudo apt-get install Kdevelop
3. 安裝cmake等
sudo apt-get install automake autoconf g++ libtool cmake
4. 配置(參考ros-wiki) http://wiki.ros.org/IDEs
cd ~/Desktop touch kDevelop.desktop chmod +x kDevelop.desktop
sudo gedit kDevelop.desktop
添加如下文本:
[Desktop Entry] Type=Application Terminal=false Exec=bash -i -c "kdevelop" Name=kDevelop Icon=kdevelop
保存退出,桌面就出現了kDevelop的圖標啦
5. 創建catkin軟件包
5.1 導入catkin頂層工作空間
首先清除掉catkin_ws文件夾下的build文件夾(下次編譯的時候它會再次出現)
打開kDevelop,使用shell 或者桌面圖標均可
點擊“工程”->"打開工程" 找到catkin_ws/src 下的 CMakelists.txt,選中,點擊“Next”, 將工程名稱修改為自己的(默認為src)
選擇“構建系統”為 "CMake Project Manager"
"Finish”
出現“配置構建目錄”窗口
將“構建目錄”改為 /home/user/catkin_ws/build/ (起初刪除的那個)
選擇合適的構建類型 “Debug/Release”
額外參數
-DCATKIN_DEVEL_PREFIX=../../devel -DCMAKE_INSTALL_PREFIX=../../install
注意:對於嵌套的子目錄結構,必須添加適當數量的 ../
6. 運行調試自己的可執行程序
點擊“代碼右側向下箭頭”->"調試啟動 F9" 進行 “啟動配置”
點擊“Add New...” 選擇要調試的可執行文件 e.g."~/catkin_ws/devel/lib/package/node_name"
"OK"
點擊 “Execute” or "Debug" 即可
7. 注意事項
如果上述過程中出現了問題,可以將 "catkin_ws/src./" 下的 “*.kdve4” 文件刪除,然后重復上述過程即可。
The "Build Type" selected during project import (e.g. "Debug", "Release", "RelWithDebInfo") can be changed by right-clicking on the project -> "Open Configuration...". Select CMake in the left menu and change the CMake variable "CMAKE_BUILD_TYPE" appropriately.
Note, if a package inside the catkin workspace specifies its own "Build Type", e.g. by adding set(CMAKE_BUILD_TYPE Release) to the underlying package "CMakeLists.txt", it will be used for that package instead of the global one defined in the top-level CMake project.
You may set up a project filter since kDevelop displays a lot of files and (ros) binaries in the source tree that are not really interesting for the developer and finding individual files could be really confusing. Right click on the project and select "Open Configuration...". Choose "Project Filter" in the left menu. The cleanest solution is to first exclude all files and then include only desired file types:
-
Click Add. Type in the pattern: "*" (just the star character) and select as "Target" only Files. Choose "Action" Exclude.
- Now add all files you want include into the project tree:
Click "Add" and type in your desired file pattern. Choose "Action" Include. Suggested file patterns are: ".h" ".cpp" ".hpp ".c" ".ipp" ".c" ".txt" ".launch" ".xml" ".md" ".cmake" ".cfg" ".py" ".yaml" ".urdf" ".sdf" ".xacro"
不想翻譯了...
