参见:官网安装说明 kinetic/Installation/Ubuntu – ROS Wiki
1) sudo sh -c ‘echo “deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main” > /etc/apt/sources.list.d/ros-latest.list’
2) sudo apt-key adv –keyserver-options http-proxy=YOUR_PROXY –keyserver hkp://http://ha.pool.sks-keyservers.net:80 –recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
3) sudo apt-get update
4) sudo apt-get install ros-kinetic-desktop-full
这里如果出错,就重新执行sudo apt-get update,再重新执行本句。
5)sudo rosdep init
如果报错:Traceback (most recent call last): File “/usr/bin/rosdep”, line 3, in <module> from rosdep2.main import rosdep_main ImportError: No module named ‘rosdep2’
解决方案推荐方案1:1)将Ubuntu默认python版本设置为2.7;2)输入命令 sudo apt-get install python3-rosdep
如果报错:
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 rosdep init
如果还是报错,检查一下sudo gedit ~/.bashrc,看看http_proxy和https_proxy是否设置正确了。
如果都是正确,还是报错,只好先忽略本步骤了。
6)rosdep update
上一步不成功,这一步肯定也不成功,只好先忽略了。
7)echo “source /opt/ros/kinetic/setup.bash” >> ~/.bashrc
source ~/.bashrc
8)sudo apt-get install python-rosinstall
9)在/etc/hosts中增加本机的别名信息
增加一行:
127.0.0.1 MyComputName #127.0.0.l和机器名的对应
10)启动ROS环境
roscore
started core service [/rosout] —-看到这一行,说明ROS启动成功