其他分享
首页 > 其他分享> > 【ROS学习】ROS系统安装 kinetic (超详细)

【ROS学习】ROS系统安装 kinetic (超详细)

作者:互联网

查看安装的Ubuntu版本,终端输入

cat /etc/issue

1、添加ROS软件源

用的是中科大的镜像,也可以用其他镜像

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'

2、添加密钥

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

3、安装ROS

sudo apt-get install ros-kinetic-desktop-full

4、初始化rosdep

sudo rosdep init

 解决方法:修改hosts试试,并且用手机热点

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

解决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

第204行

gbpdistro_url = "https://ghproxy.com/" + gbpdistro_url

第四步:

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'

第五步:

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')

5、配置环境变量

其实就是添加路径的意思

echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc


6、下载和安装ROS中的功能安装包

sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential

 测试:启动海龟仿真器

在终端输入

roscore

rosrun turtlesim turtlesim_node

 

rosrun turtlesim turtle_teleop_key

标签:ROS,安装,sudo,yaml,rosdep,https,kinetic,ros,com
来源: https://blog.csdn.net/qq_42108414/article/details/120841615