sudo rosdep init
rosdep update
如果你直接成功了,可直接跳过当我没说(不过90%的几率你都会失败的啦)
由于http://raw.githubusercontent.com这个网址墙的很厉害,大概率你是成功不了的,这里推荐一种本地化安装的方法
git clone https://github.com/ros/rosdistro.git
(如果git都失败了...,可以百度github镜像网站,镜像站下载很方便)
将rosdistro存放在/home/yourname/rosdistro
20-default.list
文件运行
sudo rosdep init
重新生成/etc/ros/rosdep/sources.list.d/20-default.list. 没有则手动创建/etc/ros/rosdep/sources.list.d/20-default.list.
如果sudo rosdep init成功,直接跳过以下创建文件步骤
进入到/etc/ros/目录下
cd /etc/ros
创建rosdep文件
sudo mkdir rosdep && cd rosdep
创建sources.list.d文件
sudo mkdir sources.list.d && cd sources.list.d
创建20-default.list文档
sudo gedit 20-default.list
将20-default.list里面内容修改为下面的代码,注意内容/home/zjl修改为自己的记录路径
# os-specific listings first
yaml file:///home/zjl/rosdistro/rosdep/osx-homebrew.yaml osx
# generic
yaml file:///home/zjl/rosdistro/rosdep/base.yaml
yaml file:///home/zjl/rosdistro/rosdep/python.yaml
yaml file:///home/zjl/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/zjl/rosdistro/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
/etc/ros/rosdep/sources.list.d/20-default.list
/usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
/usr/lib/python2.7/dist-packages/rosdep2/rep3.py
/usr/lib/python2.7/dist-packages/rosdistro/__init__.py
搜索文件中的 https://raw.githubusercontent.com/ros/rosdistro/master字段,将其替换为file:///home/yourname/rosdistro(后面的部分保持不变,最好备份一下)
例如:
//进行如下修改
#DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
DEFAULT_INDEX_URL = 'file:///home/zjl/rosdistro/index-v4.yaml
注:最好每个文件都确定一下是否只有一个
例如:我的电脑查找
最后发现不止一个 init.py ,这时最好两个都要修改
接下来就可以愉快的rosdep update啦
由于是本地安装就不会失败啦
附上成功截图
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
最后安装个实用插件
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
运行
roscore
若出现下图,并无报错,就安装好啦