系统:Ubuntu 16.04
Ros系统:kinetic
步骤:
(1)配置Ubuntu的资源库:"restricted","universe"和"multiverse"。一般情况是不用配置的,参考下图红色框部分。
如果没有配置,可以参考Ubuntu官网:点击打开链接
http://wiki.ros.org/kinetic/Installation/Ubuntu
源可以选择国内比较快速的源,推荐使用例如:http://mirrors.ustc.edu.cn,。
(2)设置Ubuntu的sources.list,按照官网的选择国内的ustc的
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
(3)设置key,可见http://wiki.ros.org/kinetic/Installation/Ubuntu的步骤1.3
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
(4)更新package
sudo apt-get update
(5)安装ROS kinetic完整版
sudo apt-get install ros-kinetic-desktop-full
安装完可以查看可用的package:
apt-cache search ros-kinetic
(6)初始化rosdep:在使用ROS之前必须要初始化rosdep
sudo rosdep init
rosdep update
(7)配置环境
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
(8)安装building package的依赖
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
(9)测试ROS安装成功:
打开Termial,输入以下命令,初始化ROS环境:
roscore
打开新的Termial,输入以下命令,弹出一个小乌龟窗口:
rosrun turtlesim turtlesim_node
转载:https://blog.csdn.net/softimite_zifeng/article/details/78632211
(10)安装过程中遇到了:
(10.1)
The following packages have unmet dependencies:
ros-kinetic-desktop-full : Depends: ros-kinetic-desktop but it is not going to be installed
Depends: ros-kinetic-perception but it is not going to be installed
Depends: ros-kinetic-simulators but it is not going to be installed
Depends: ros-kinetic-urdf-tutorial but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
找到的解决方法是:
在sources.list中加上
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
然后从第(2)步重新开始执行。
(10.2)执行sudo rosdep init出现:
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.
需要sudo使用 -E 来保留 环境变量配置
sudo -E rosdep init