“学习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机器人驱动包的过程中,我遇到并记录了我在安装、编译和运行时所出现的问题和解决方法,并分享给你们。
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显示正确
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 则编译成功且此错误解决。
1、 cannot launch node of type [laptop_battery_monitor/laptop_battery.py]: laptop_battery_monitor
解决:
sudo apt-get install ros-kinetic-laptop-battery-monitor
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