ROS入門第五篇之使用Eclipse

更多內容:請關注博主微信(cc806522806)或公衆號(待開放),未經博主同意請勿轉載!

1、下載Eclipse  點擊下載

2、創建工程文件

cd ~/catkin_ws
catkin_make --force-cmakee -G"Eclipse CDT4 - Unix Makefiles"

3、設置終端的環境變量到Eclipse

awk -f $(rospack find mk)/eclipse.awk build/.project > build/.project_with_env && mv build/.project_with_env build/.project

4、調試

cd ~/catkin_ws/src
cmake ../src -DCMAKE_BUILD_TYPE=Debug

5、將工程導入Eclipse

File->Import->Existing Projects into Workspace
Next->Finish

 番外

書中提到,如果將源碼包 ros_exploring 直接放到 catkin 工作空間中,需要將 ros2 文件夾移出到工作空間之外,否則編譯失敗。
將 ros2 文件夾移出之後仍然報錯,具體信息如下:

Could not find the required component ‘ecto’. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.

CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by “ecto” with any of
the following names:
ectoConfig.cmake
ecto-config.cmake

Add the installation prefix of “ecto” to CMAKE_PREFIX_PATH or set
“ecto_DIR” to a directory containing one of the above files. If “ecto”
provides a separate development package or SDK, be sure it has been
installed.

出錯原因爲缺少 ecto 這個包,使用如下命令安裝再重新編譯即可解決問題:

$ sudo apt-get install ros-kinetic-ecto 

同理,若缺少 manipulation-msgs 包則如下命令安裝:

$ sudo apt install ros-kinetic-manipulation-msgs 

gazebo_ros_control 包:

$ sudo apt install ros-kinetic-gazebo-ros-control

缺少鏈接庫報錯:
/usr/bin/ld: cannot find -lmsc
collect2: error: ld returned 1 exit status

解決方法:參考書中207頁說明,將科大訊飛的SDK庫文件拷貝到系統目錄下:

注:先進入庫文件所在文件夾 ros_exploring/robot_perception/robot_voice/libs/x64(32位系統最後選擇x86文件夾) 再執行如下命令

$ sudo cp libmsc.so /usr/lib/libmsc.so

權限錯誤:

/home/jyk/catkin_ws/build/ros_exploring/ros_advanced/dynamic_tutorials/setup_custom_pythonpath.sh: 5:exec: /home/jyk/catkin_ws/src/ros_exploring/ros_advanced/dynamic_tutorials/cfg/Tutorials.cfg: Permission denied
ros_exploring/ros_advanced/dynamic_tutorials/CMakeFiles/dynamic_tutorials_gencfg.dir/build.make:63: recipe for target ‘/home/jyk/catkin_ws/devel/include/dynamic_tutorials/TutorialsConfig.h’ failed

進入 ros_exploring/ros_advanced/dynamic_tutorials/cfg 文件夾,執行如下命令:

$ chmod +x Tutorials.cfg

pocketsphinx 語音包安裝報錯:
 

ImportError: No module named pygst

錯誤原因爲缺少 python-gst 依賴,執行如下命令即可解決問題:

  $ sudo apt install python-gst0.10

最後,重新編譯

cd ~/catkin_ws/src
catkin_make


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章