安装ros时候source /.bashrc没有哪个文件或目录

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装ros时候source /.bashrc没有哪个文件或目录相关的知识,希望对你有一定的参考价值。

参考技术A 可以手工填入些内容
touch ~/.bashrc
参考技术B 同求解,我也遇到了相关问题

ubuntu20.04安装noetic版本ros

文章目录

1. ubuntu设置为中文界面

Ubuntu20.04 英文界面换成中文界面

2.配置Ubuntu软件仓库



3.设置sources.list

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

利用 “sh -c” 命令,它可以让 bash 将一个字串作为完整的命令来执行,这样就可以将 sudo 的影响范围扩展到整条命令,这条命令的意思是把"deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main"双引号中的内容添加到/etc/apt/sources.list.d/ros-latest.list文件中。

4.设置密钥

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

5. 安装ros

安装之前先执行sudo apt update更新软件源,我们这里安装桌面完整版本:

sudo apt install ros-noetic-desktop-full

6. 设置环境

你需要在使用ROS的每个bash终端中source这个脚本。

source /opt/ros/noetic/setup.bash

而下面这些命令可以在每次启动新的shell窗口时很方便地为你自动source一下这个脚本

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

7. 测试ROS安装是否成功

在终端输入:
roscore 启动RosMaster
再新建一个终端,输入:
rosrun turtlesim turtlesim_node
再新建一个终端,输入:
rosrun turtlesim turtle_teleop_key

8. 初始化rosdep

开始使用ROS之前,先初始化rosdep,rosdep能够轻松地安装要编译的源代码的系统依赖关系,rosdep是ROS核心组件运行的基础

rosdep是ros的一个功能包,在安装ros时会自动安装.在使用时需要初始化.ros包有两个不同类型的依赖项:build依赖项和run依赖项。rosdep就是用来检查包的丢失依赖项,并且完成下载和安装。

执行sudo rosdep init,提示sudo: rosdep:找不到命令
需要安装sudo apt-get install python3-rosdep2
然后重新

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.

如果 /etc/ros/rosdep/sources.list.d目录存在,则只需修改/etc/ros/rosdep/sources.list.d目录下的文
件,如果/etc/ros/rosdep/sources.list.d目录不存在,需要手动创建上面所述的目录:
/etc/ros/rosdep/sources.list.d (当然说的是在etc目录下…),自己制作20-default.list文件。

8.1 如/etc/ros/rosdep/sources.list.d目录存在

cd /etc/ros/rosdep/sources.list.d
sudo gedit 20-default.list

在每一个https://raw.githubusercontent.com/前面添加https://ghproxy.com/
修改好的

# os-specific listings first
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx

# generic
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://ghproxy.com/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,前面4个网址访问成功,但最后1个还是访问,错误信息如下:

kandi@ubuntu:/etc/ros/rosdep/sources.list.d$ rosdep update
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
ERROR: unable to process source [https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml]:
	Failed to download target platform data for gbpdistro:
	<urlopen error [Errno 111] Connection refused>
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
ERROR: error loading sources list:
	<urlopen error <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml)>

提示无法访问https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml和https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml,此时需要修改index-v4.yaml所在的位置。
需要特别注意:

ros noetic版本基于python3,所以在/usr/lib/python3路径下修改,其他ros版本若基于python2的,需要找到对应的python2 路径进行修改。

修改的方法是在下面这些文件中https://raw.githubusercontent.com前面加上https://ghproxy.com/
(1) 修改

sudo gedit /usr/lib/python3/dist-packages/rosdep2/gbpdistro_support.py

(2) 修改在__init__.py文件中修改index-v4.yaml的位置

sudo gedit /usr/lib/python3/dist-packages/rosdistro/__init__.py


继续rosdep update,但还有出错的信息:

把下面几个文件对应的地方也改了

/usr/lib/python3/dist-packages/rosdep2/sources_list.py
 /usr/lib/python3/dist-packages/rosdep2/rep3.py
/usr/lib/python3/dist-packages/rosdistro/manifest_provider/github.py此文件两个地方需要修改

继续rosdep update,还是有问题,比如:

ERROR: unable to process source [https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml]

在多执行几次rosdep update就ok了,信息如下:

kandi@ubuntu:~$ rosdep update
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Skip end-of-life distro "dashing"
Skip end-of-life distro "eloquent"
Add distro "foxy"
Add distro "galactic"
Skip end-of-life distro "groovy"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Skip end-of-life distro "jade"
Skip end-of-life distro "kinetic"
Skip end-of-life distro "lunar"
Add distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /home/kandi/.ros/rosdep/sources.cache

8.2 /etc/ros/rosdep/sources.list.d目录不存在

手动创建上面所述的目录: /etc/ros/rosdep/sources.list.d ,自己创建20-default.list文件。
在终端输入

cd /etc
sudo mkdir ros
cd ros
sudo mkdir rosdep
cd rosdep
sudo mkdir sources.list.d
cd sources.list.d
Sudo gedit 20-default.list

在gedit 20-default.list上粘贴下面的内容:

#os-specific listings first
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
#generic
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://ghproxy.com/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

以上是关于安装ros时候source /.bashrc没有哪个文件或目录的主要内容,如果未能解决你的问题,请参考以下文章

ubuntu20.04安装noetic版本ros

ubuntu20.04安装noetic版本ros

安装Ros时遇到E: Malformed entry 1 in list file /etc/apt/sources.list.d/ros-latest.list (Component)错误的解决方案

安装Ros时遇到E: Malformed entry 1 in list file /etc/apt/sources.list.d/ros-latest.list (Component)错误的解决方案

Ubuntu 18.04 版本下安装ROS 系统

ros安装过程中出现的rosdep init ERROR :cannot download default sources list from :解决办法