sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
3.更新软件源,更新前面添加的ROS软件源,否则会找不到安装包(E: 无法定位软件包 ros–noetic–desktop–full),更新软件源即可
sudo apt update
4.安装ROS(根据Ubuntu的不同版本选择不同版本的ROS,20.04对应的是noetic版本)
sudo apt install ros-noetic-desktop-full
sudo rosdep init
运行:
rosdep update
方法一:直接运行
运气好的网络多运行几次就可以成功,但大多数是很难成功的,或者可以通过魔法进行更新,概率比正常会大很多,成功之后如下所示: 方法二:
如果尝试多次不能成功可以通过将文件下载至本地,对本地文件进行链接
git clone https://github.com/ros/rosdistro.git
通过命令拉取迟迟没有反应,可以直接访问上面的github连接直接下载到本地,放在home目录下,将文件名重命名为 rosdistro,根据以下步骤分别替换五个文件中的内容
注意:此方法中的所有yourname都需要改为自己电脑的用户名
cd /home/yourname/rosdistro/rosdep/sources.list.d/
sudo gedit 20-default.list
# os-specific listings first
yaml file:///home/yourname/rosdistro/rosdep/osx-homebrew.yaml osx
# generic
yaml file:///home/yourname/rosdistro/rosdep/base.yaml
yaml file:///home/yourname/rosdistro/rosdep/python.yaml
yaml file:///home/yourname/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/yourname/rosdistro/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
第二个文件:(注:20.04的python版本为python3,低版本的python版本为python2.7,进行相应的更改即可)
cd /usr/lib/python3/dist-packages/rosdep2/
sudo gedit gbpdistro_support.py
替换为:
FUERTE_GBPDISTRO_URL = 'file:///home/yourname/rosdistro/'
'releases/fuerte.yaml'
cd /usr/lib/python3/dist-packages/rosdep2/
sudo gedit rep3.py
替换为:
REP3_TARGETS_URL = 'file:///home/yourname/rosdistro/releases/targets.yaml'
第四个文件:
cd /usr/lib/python3/dist-packages/rosdistro/
sudo gedit __init__.py
替换为 :
DEFAULT_INDEX_URL = 'file:///home/yourname/rosdistro/index-v4.yaml'
第五个文件:
cd /etc/ros/rosdep/sources.list.d
sudo gedit 20-default.list
替换为:
#os-specific listings first
yaml file:///home/yourname/rosdistro/rosdep/osx-homebrew.yaml osx
#generic
yaml file:///home/yourname/rosdistro/rosdep/base.yaml
yaml file:///home/yourname/rosdistro/rosdep/python.yaml
yaml file:///home/yourname/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/yourname/rosdistro/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
成功解决!!!
方法三:这部分完全参考这篇文章,超级好用,简单高效:https://zhuanlan.zhihu.com/p/398754989
安装
sudo pip install rosdepc
sudo pip3 install rosdepc
sudo apt-get install python3-pip
sudo pip install rosdepc
sudo rosdepc init
rosdepc update
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
7.安装rosinstall
sudo apt install python3-rosinstall python3-rosinstall-generator python3-wstool
roscore
成功运行 !!!!!!!!!!!!!!!!!
原文地址:https://blog.csdn.net/abc20150125/article/details/129996764
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_18867.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!