Turtlebot2小車機器人驅動包安裝、編譯和運行問題合集

“學習SLAM的過程真的很快樂” ————沃茲吉.梭德

在學習激光和視覺SLAM的過程中,除了掌握SLAM的基礎知識之外,還需要學習ROS和Ubuntu等工具的使用,以便能更好的瞭解SLAM、驗證算法和測試實驗等。我們課題組中所使用的實驗設備是Turtlebot2小車機器人,對於初學者是非常適合的。我在Ubuntu18.04和Ubuntu16.04上面都安裝過Turtlebot2機器人的驅動包,但在Ubuntu18.04上面運行Turtlebot2機器人驅動包中某個建圖程序時遇到一個問題,具體問題當初忘記記錄下來了,最後經過查閱相關問題選擇把Ubuntu18.14換成Ubuntu16.04。故建議Turtlebot2小車機器人的驅動包在Ubuntu16.04上面安裝和使用。在Ubuntu16.04安裝Turtlebot2機器人驅動包的過程中,我遇到並記錄了我在安裝、編譯和運行時所出現的問題和解決方法,並分享給你們。

一、Turtlebot2驅動安裝

1、Turtlebot2驅動安裝過程具體看網站“智能創客”中的教程:
Turtlebot入門教程-安裝Turtlebot(ubuntu16.04+kinetic).

2、在安裝過程中可能會需要安裝rocon,則rocon依次安裝步驟如下

mkdir -p catkin_ws/src
cd catkin_ws/src
wstool init -j5 src https://raw.github.com/robotics-in-concert/rocon/release/kinetic/rocon.rosinstall
catkin_make

若出現問題:ros-kinetic-rocon-remocon ros-kinetic-rocon-qt-library無法定位軟件源
解決:
1)手動安裝,使用git下載軟件源碼到ros工作目錄catkin_ws/src/下(創建方法參考http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment),等待編譯。

git clone https://github.com/robotics-in-concert/rocon_qt_gui.git

2)下載完成,在編譯之前需要添加編譯依賴資源,pyrcc5,pyrcc4,因此手動安裝這兩個依賴項,

sudo apt-get install pyqt4-dev-tools
sudo apt-get install pyqt5-dev-tools

然後編譯該工作目錄cd ~/catkin_ws/catkin_make至此,Turtlebot就成功安裝。

3、檢查設備是否連接成功
啓動ros:roscore輸入檢測命令:ls /dev/kobuki 會顯示有對應的設備/dev/kobuki 如果沒有,添加別名:rosrun kobuki_ftdi create_udev_rules 重插USB線,再進行上述的檢測命令

若出現錯誤:“rosrun kobuki_ftdi create_udev_rules時,[rospack] Error: package ‘kobuki_ftdi’ not found”

解決:終端中輸入

sudo apt-get install ros-kinetic-kobuki-ftdi 

ls /dev/kobuki顯示正確

二、在Turtlebot2工作空間catkin_make編譯時

1、報錯:“CMake Error at CMakeLists.txt:65 (message):find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.”

解決:原因是kinetic路徑沒有配置正確,在.bashrc文件中最下面輸入source/opt/ros/kinetic/setup.bash即可。

2、報錯:“ Could not find a package configuration file provided by “tf2_sensor_msgs” ”
with any of the following names:
tf2_sensor_msgsConfig.cmake
tf2_sensor_msgs-config.cmake


解決:在終端中輸入

sudo apt-get install ros-kinetic-tf2-sensor-msgs

3、報錯:“Could not find a package configuration file provided by “kobuki_dock_drive” ”

解決:在終端中輸入

sudo apt-get install ros-kinetic-kobuki-dock-drive

4、報錯:“recipe for target ‘robot_pose_ekf/CMakeFiles/robot_pose_ekf.dir/all’ failed”

解決:由於工作空間之前是編譯過的,編譯的數據都在build和devel文件中,所以刪除了build和devel中的文件之後就可以解決問題了。

5、報錯:“fatal error: bluetooth/bluetooth.h: No such file or directory”

解決:還是系統庫沒有安裝完全,再更新安裝一下:

sudo apt-get install libbluetooth-dev

6、報錯:“fatal error: cwiid.h: No such file or directory”

(1) 到github上克隆源碼

git clone https://github.com/abstrakraft/cwiid/tree/master

(2) 終端中位置在/home/cwiid,輸入以下命令:

cd cwiid
aclocal
autoconf
./configure
make
sudo make install

(3) 當執行./configure時,可能會報錯“configure: error: flex not found”,執行命令:

sudo apt-get install flex

(4)繼續執行./configure時,可能還是會出現報錯“error: bison not found”,執行命令:

sudo apt-get install bison byacc

(5) 最後查看cwiid.h的位置:

whereis cwiid.h

若出現:cwiid: /usr/local/etc/cwiid /usr/local/lib/cwiid 則編譯成功且此錯誤解決。

三、在turtlebot2工作空間路徑下終端輸入roslaunch時

1、 cannot launch node of type [laptop_battery_monitor/laptop_battery.py]: laptop_battery_monitor

解決:

sudo apt-get install ros-kinetic-laptop-battery-monitor

四、在roslaunch turtlebot_navigation gmapping_demo.launch時遇到的問題

1、報錯:“ResourceNotFound: openni_launch”
解決:終端中輸入

sudo apt-get install ros-kinetic-openni-launch

2、roslaunch時異常
解決:配置kinect驅動

sudo apt-get install  ros-kinetic-freenect-*
rospack profile

然後驗證

echo $TURTLEBOT_3D_SENSOR

3、報錯:“ ERROR: cannot launch node of type [move_base/move_base]: move_base
ROS path [0]=/opt/ros/indigo/share/ros
ROS path [1]=/home/qking/catkin_ws/src
ROS path [2]=/opt/ros/indigo/share
ROS path [3]=/opt/ros/indigo/stacks ”



解決:終端中輸入

sudo apt-get install ros-kinetic-move-base

4、報錯:“ERROR: cannot launch node of type [gmapping/slam_gmapping]: gmapping
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/home/peng/turtlebot3_ws/src
ROS path [2]=/home/peng/catkin_ws/src
ROS path [3]=/home/peng/study_ws/src
ROS path [4]=/opt/ros/kinetic/share ”




解決:終端中輸入

sudo apt-get install ros-kinetic-gmapping

5、 報錯:“Failed to create the dwa_local_planner/DWAPlannerROS planner, are you sure it is properly registered and that the containing library is built? ”

解決:終端中輸入

sudo apt-get install ros-kinetic-dwa-local-planner

6、報錯:“[keyboard_teleop.launch] is neither a launch file in package [turtlebot_teleop] nor is [turtlebot_teleop] a launch file name ”

解決:終端中輸入

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