查看安装的Ubuntu版本,终端输入
cat /etc/issue
用的是中科大的镜像,也可以用其他镜像
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'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get install ros-kinetic-desktop-full
sudo rosdep init
cd /etc
sudo gedit hosts
手动进行完成sudo rosdep init的步骤
1、创建一个source.list.d 的文件夹
sudo mkdir -p /etc/ros/rosdep/sources.list.d
2、进入source.list.d文件夹
cd /etc/ros/rosdep/sources.list.d
3、创建并编辑20-default.list 文件
sudo gedit 20-default.list
4、将下列内容复制进20-default.list 文件中
# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
再执行rosdep update
rosdep update
采用代理即可:方法如下
https://ghproxy.com/
对于github下载十分友好!
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py
第311行 download_rosdep_data 函数里添加,在try里面
url="https://ghproxy.com/"+url
第72行
其实就是在网站前面加代理网站 https://ghproxy.com/
DEFAULT_SOURCES_LIST_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list'
sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py
第68行
DEFAULT_INDEX_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
第36行
FUERTE_GBPDISTRO_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/' \
'master/releases/fuerte.yaml'
第204行
gbpdistro_url = "https://ghproxy.com/" + gbpdistro_url
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py
第39行
REP3_TARGETS_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml'
sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/manifest_provider/github.py
第68行119行
url = 'https://ghproxy.com/https://raw.githubusercontent.com/%s/%s/package.xml' % (path, release_tag)
url = 'https://ghproxy.com/https://raw.githubusercontent.com/%s/%s/%s' % \
(path, cache.ref(), package_xml_path + '/package.xml' if package_xml_path else 'package.xml')
其实就是添加路径的意思
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
测试:启动海龟仿真器
在终端输入
roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key