ROS_Kinetic系列学习(一),在ubuntu 16.04安装ROS Kinetic。
http://wiki.ros.org/kinetic/Installation/Ubuntu
通过网页快速了解Linux(Ubuntu)和ROS机器人操作系统,请参考实验楼在线系统如下:
纯净定制版镜像已经发布,供ROS爱好者交流学习,在如下链接:Ubuntu 16.04 + ROS Kinetic 机器人操作系统学习镜像分享与使用安装说明_zhangrelay的博客-CSDN博客_ros 镜像
Ubuntu 16.04 + ROS Kinetic 机器人操作系统学习镜像分享与使用安装说明
ubuntu16.04已经发布半年多了,ROS的Kinetic版本功能包也越来越丰富了,需要了解ROS发行版及支持维护的时间等,
可以参考如下网页:Distributions - ROS Wiki
+
1. ROS kinetic安装与使用
参考的网址:kinetic - ROS Wiki
:kinetic/Installation/Ubuntu - ROS Wiki
2.1 设置安装源
ROS Kinetic只支持Wily(15.10)和Xenial(16.04)对应内核分别为4.2和4.4,其他版本需要编译安装不支持直接deb软件源安装,
使用下面命令:
~$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
2.2 设置keys
~$ sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116
Executing: /tmp/tmp.vZcRo5lOC8/gpg.1.sh --keyserver
hkp://ha.pool.sks-keyservers.net:80
--recv-key
0xB01FA116
2.3 安装
~$ sudo apt-get update
~$ sudo apt-get install ros-kinetic-desktop-full
安装功能包:
~$ sudo apt-get install ros-kinetic-PACKAGE
例如:
~$ sudo apt-get install ros-kinetic-slam-gmapping
查找在kinetic中可以使用的功能包:
~$ apt-cache search ros-kinetic
2.4 初始化
~$ sudo rosdep init
Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run
rosdep update
~$ rosdep update
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index.yaml
Add distro "groovy"
Add distro "hydro"
Add distro "indigo"
Add distro "jade"
Add distro "kinetic"
updated cache in /home/relaybot/.ros/rosdep/sources.cache
2.5 环境配置
~$ echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
~$ source ~/.bashrc
注意当安装多个ROS发行版,使用kinetic需要用到下面命令:
~$ source /opt/ros/kinetic/setup.bash
2.6 安装rosinstall
~$ sudo apt-get install python-rosinstall
2.7 测试roscore
~$ roscore
官网的讲解还是比较清晰的大脚可以参考:http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment
(该部分转载自:http://blog.csdn.net/ZhangRelay/article/details/51364622)
笔者在实现的过程中遇到了一下问题,记录一下报错以及解决方法
usb_cam安装过程:
安装包下载地址:https://github.com/ros-drivers/usb_cam
编译过程:http://blog.csdn.net/xiaocainiaoshangxiao/article/details/13293637
在官网上本节的题目是Creating a workspace for catkin,其中的catkin不知道是什么意思,在网上找到的结果是:(1)卡婷是一个广告公司,(2)葇荑花。这两种翻译显然都不太合适,不过不知道也没关系,影响不大。我们知道catkin是一个ROS中的工具就行了。本节的主要目的是创建一个catkin工作空间,在这个工作空间中,catkin的包可以被编译。
如果您还没有安装catkin的话,请首先安装catkin。不过如果按照前面的步骤的话,catkin已经安装了。
首先需要修改环境变量,按ctrl+alt+t打开一个终端,在里面输入:
- source /opt/ros/hydro/setup.bash
也可以按照前面所讲的,将其直接修改为永久性的。
创建一个工作空间:
- mkdir -p ~/catkin_ws/src
- cd ~/catkin_ws/src
通过上面两条命令,就可以创建一个工作空间,并转到已创建好的工作空间之下,尽管这个空间是空的,我们仍然可以构建(build)它:
- cd ~/catkin_ws/
- catkin_make
当时用catkin工作空间时,catkin_make是一个非常方便的命令行工具。如果您看一下当前的工作目录,您会发现里面多了两个文件夹“build”和“devel”。在devel文件夹下,您可以看到很多setup.*sh文件。输入如下命令配置您的工作空间:
- source devel/setup.bash
报错如下:-- ~~ - visualization_marker_tutorials
-- ~~ - xacro
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CMake Error at catkin/cmake/catkin_workspace.cmake:95 (message):
This workspace contains non-catkin packages in it, and catkin cannot build
a non-homogeneous workspace without isolation. Try the
'catkin_make_isolated' command instead.
Call Stack (most recent call first):
CMakeLists.txt:63 (catkin_workspace)
-- Configuring incomplete, errors occurred!
See also "/home/sun/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/sun/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" faile
解决方法:-- catkin_make 工作空间不能与 非catkin文件建立联系改用catkin_make_isolated,安心等待一会编译 完成后即可
在sun@sun:~/catkin_ws/build$ 编译即可。
扩展,ros不必使用catkin_make进行编译,而是用rosmake进行编译
当你使用rosmake进行编译的时候,如果提示没有找到这个包,那么很有可能是你没有用source ~/catkin_ws/devel/setup.bash 就是让编译器能够找到这个包