1 确定ROS 发行版版本
在ROS wiki搜索(或者google)turtlebot install,会出现安装方法网址如下,
link:http://wiki.ros.org/turtlebot/Tutorials/indigo/Turtlebot%20Installation
如果你的ROS不是indigo版本的,点击图1中的turtlebot超链接:
图1
会进入这个页面,link:http://wiki.ros.org/action/show/Robots/TurtleBot?action=show&redirect=TurtleBot
下面有关于TURTLEBOT3和2的安装PKG,以安装turtlebot3的pkg为例,如图2所示,
图2
依次安装这些pkg,以第一个turtlebot3这个PKG为例,点开超链接,如图3所示,
image widget
图3
点击右侧的dependencies,查看依赖包,点击依赖包安装全部之后才能继续安装turtlebot3这个包,这里有所不同的是,点开左下角的Source;git https://github.com/ROBOTIS-GIT/turtlebot3.git,在github上发现所有的依赖包都有,因此可以直接使用如下命令批量安装
cd ~/catkin_ws/src
git clone https://github.com/ROBOTIS-GIT/turtlebot3.git
下载好后,
方法一:可以选择在当前目录安装使用如下命令:
cd ~/catkin_ws
catkin_make
source ./devel/setup.bash
方法二,因为这是常用的包,可以将它放到ROS库的PKG中,通过如下方式查看pkg的位置
$ echo $ROS_PACKAGE_PATH
/home/simileciwh/catkin_ws/src:/opt/ros/melodic/share
用“:”相隔表示当前环境有两个ROS包的路径,/opt/ros/melodic/share是系统ROS的默认路径,通过如下指令安装
sudo su
#输入root密码
cd /home/<你的用户名对应的目录>/catkin_ws/src
cp -r <"刚刚下载的turtlebot3包的名字"> /opt/ros/melodic/share
注意使用这种直接拷贝的方式安装,一定要确保所有依赖关系都安装全了,不然当你运行到特定的节点时会报错,这时一句错我提示,讲该文件拷贝到catkin_ws/src文件夹下,然后使用方法一构建节点,根据提示将少的pkg安装上。
用如下指令查看PKG是否安装完成,如下所示就算安装结束了,可以直接使用roslaunch,或者rosrun运行节点。
$ rospack list
turtlebot3_automatic_parking /opt/ros/melodic/share/turtlebot3_applications-master/turtlebot3_automatic_parking
turtlebot3_automatic_parking_vision /opt/ros/melodic/share/turtlebot3_applications-master/turtlebot3_automatic_parking_vision
turtlebot3_autorace_camera /opt/ros/melodic/share/turtlebot3_autorace-master/turtlebot3_autorace_camera
turtlebot3_autorace_control /opt/ros/melodic/share/turtlebot3_autorace-master/turtlebot3_autorace_control
turtlebot3_autorace_core /opt/ros/melodic/share/turtlebot3_autorace-master/turtlebot3_autorace_core
turtlebot3_autorace_detect /opt/ros/melodic/share/turtlebot3_autorace-master/turtlebot3_autorace_detect
turtlebot3_bringup /opt/ros/melodic/share/turtlebot3-master/turtlebot3_bringup
turtlebot3_description /opt/ros/melodic/share/turtlebot3-master/turtlebot3_description
turtlebot3_example /opt/ros/melodic/share/turtlebot3-master/turtlebot3_example
turtlebot3_fake /opt/ros/melodic/share/turtlebot3_simulations-master/turtlebot3_fake
turtlebot3_follow_filter /opt/ros/melodic/share/turtlebot3_applications-master/turtlebot3_follow_filter
turtlebot3_follower /opt/ros/melodic/share/turtlebot3_applications-master/turtlebot3_follower
turtlebot3_gazebo /opt/ros/melodic/share/turtlebot3_simulations-master/turtlebot3_gazebo
turtlebot3_msgs /opt/ros/melodic/share/turtlebot3_msgs-master
turtlebot3_navigation /opt/ros/melodic/share/turtlebot3-master/turtlebot3_navigation
turtlebot3_panorama /opt/ros/melodic/share/turtlebot3_applications-master/turtlebot3_panorama
turtlebot3_slam /opt/ros/melodic/share/turtlebot3-master/turtlebot3_slam
turtlebot3_teleop /opt/ros/melodic/share/turtlebot3-master/turtlebot3_teleop
注意,有些PKG的安装方法在相应的github上有链接,按照作者的方式来,不要一味使用上诉方式
如果此时直接运行turtlebot3的相关节点会,提示“没有给turtlebot3选定model”,通过以下指令配置:
export TURTLEBOT3_MODEL=<在burger,waffle,waffle_pi三种中选择一个,一般我们选择burger>
#commond-line like this:
$ export TURTLEBOT3_MODEL=burger
2 gazebo仿真
2.1 安装gazebo
link:http://gazebosim.org/tutorials/?tut=ros_wrapper_versions
如图4所示,
图4
点击图中installing gazebo_ros_pkgs,进入,link:http://gazebosim.org/tutorials?tut=ros_installing&cat=connect_ros
按照步骤进行安装。注意最好选择以源的形式进行安装。
测试基本完成后,用以下命令运行gazebo_ros仿真,即可完成。
$ roslaunch turtlebot3_gazebo turtlebot3_world.launch
#注意要先运行roscore
第一次运行gazebo仿真打开时间会较长,或者失败,请耐心多尝试几次即可。
3 可以在YouTube上学习一些关于此的方法
link:https://www.youtube.com/watch?v=DLVyc9hOvk8&list=PLJNGprAk4DF5PY0kB866fEZfz6zMLJTF8&index=4
2018-10-4 updating
4 因为重装系统的原因又重新配置了turtlebot3的环境,遇到了一些新老问题,记录解决办法如下:
4.1 Could NOT find GLEW (missing: GLEW_INCLUDE_DIR GLEW_LIBRARY)
-- +++ processing catkin package: 'moveit_ros_perception'
-- ==> add_subdirectory(moveitPkg/moveit-melodic-devel/moveit_ros/perception)
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- thread
-- signals
-- chrono
-- system
-- date_time
-- atomic
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find GLEW (missing: GLEW_INCLUDE_DIR GLEW_LIBRARY)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.10/Modules/FindGLEW.cmake:38 (find_package_handle_standard_args)
moveitPkg/moveit-melodic-devel/moveit_ros/perception/CMakeLists.txt:16 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/simileciwh/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/simileciwh/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:22678: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
解决办法:
$ sudo apt-get install libglew-dev
4.2 Could not find a package configuration file provided by "ompl" with any of
the following names:
-- +++ processing catkin package: 'moveit_planners_ompl'
-- ==> add_subdirectory(moveitPkg/moveit-melodic-devel/moveit_planners/ompl)
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- system
-- filesystem
-- date_time
-- thread
-- serialization
-- chrono
-- atomic
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Error at moveitPkg/moveit-melodic-devel/moveit_planners/ompl/CMakeLists.txt:22 (find_package):
By not providing "Findompl.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "ompl", but
CMake did not find one.
Could not find a package configuration file provided by "ompl" with any of
the following names:
omplConfig.cmake
ompl-config.cmake
Add the installation prefix of "ompl" to CMAKE_PREFIX_PATH or set
"ompl_DIR" to a directory containing one of the above files. If "ompl"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
See also "/home/simileciwh/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/simileciwh/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:22678: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
解决方法:
$ sudo apt-get install ros-melodic-ompl