在树莓派自带系统Raspbian中安装ros kinetic以及turtlebot依赖包

在树莓派自带系统Raspbian中安装ros kinetic以及turtlebot依赖包

书接上文,上文提到了在树莓派自带系统Raspbian中安装ros kinetic的教程安装教程,但在安装过程中遇到了一些问题,在这里记录一下。
如何使用一根USB线便在电脑上控制树莓派在我的另一篇博客有写,可以前去查看。

1.引导依赖项缺失问题

在上面链接中,执行到1.2安装引导依赖项指令时,会报错,我的错误如下:

You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 python-rosdep-modules : Depends: python-rospkg-modules (>= 1.1.10) but it is not going to be installed
                         Depends: python-catkin-pkg-modules (>= 0.4.0) but it is not going to be installed
                         Depends: python-rosdistro-modules (>= 0.7.5) but it is not going to be installed
 python-rosdistro : Depends: python-rosdistro-modules (>= 0.8.3) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

根据提示,输入以下指令:

$ sudo apt --fix-broken install

后,又出现了以下错误:

dpkg: error processing archive /var/cache/apt/archives/python-catkin-pkg-modules_0.4.23-1_all.deb (--unpack):
 trying to overwrite '/usr/lib/python2.7/dist-packages/catkin_pkg/__init__.py', which is also in package python-catkin-pkg 0.4.10-1
Preparing to unpack .../python-rospkg-modules_1.2.8-1_all.deb ...
Unpacking python-rospkg-modules (1.2.8-1) ...
dpkg: error processing archive /var/cache/apt/archives/python-rospkg-modules_1.2.8-1_all.deb (--unpack):
 trying to overwrite '/usr/lib/python2.7/dist-packages/rospkg/__init__.py', which is also in package python-rospkg 1.1.7-1
Errors were encountered while processing:
 /var/cache/apt/archives/python-catkin-pkg-modules_0.4.23-1_all.deb
 /var/cache/apt/archives/python-rospkg-modules_1.2.8-1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

能够看出是两个问题,分别执行下面的指令即可:

$ sudo dpkg -i --force-overwrite /var/cache/apt/archives/python-catkin-pkg-modules_0.4.23-1_all.deb
$ sudo apt-get -f install
$ sudo dpkg -i --force-overwrite /var/cache/apt/archives/python-rospkg-modules_1.2.8-1_all.deb
$ sudo apt-get -f install

PS:可能module的号不同,比如我缺的是catkin的0.4.23-1和rospkg的1.2.8-1,大家根据错误提示自己修改一下即可。
然后输入以下指令便不再报错:

$ sudo apt --fix-broken install

再用下面的指令更新一下rosdep:

$ sudo rosdep update

然后再运行教程中的1.2安装引导依赖项指令即可:

$ sudo apt-get install -y python-rosdep python-rosinstall-generator python-wstool python-rosinstall build-essential cmake

若网络不好,就多试几遍。

2.初始化时报错DistributionNotFound

在执行教程中步骤1.3中指令:

$ sudo rosdep init

出现如下错误:

DistributionNotFound: The 'rospkg>=1.1.10' distribution was not found and is required by rosdep

重新安装 Python版本的 rosdep的即可

sudo apt install python3-rosdep

安装完之后继续执行init指令,但是有报错:

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/hosts文件末尾添加上一个网址:

151.101.84.133 raw.githubusercontent.com

用什么方式添加都可以,包括用gedit、vim,或者直接在图形化界面打开这个文件进行更改,这里列出用gedit和vim添加的方法,任选其一即可:
gedit添加网址:

sudo gedit /etc/hosts

然后在末尾添加网址。

vim添加网址:

sudo vi /etc/hosts

然后按i进入vim的insert模式,然后把光标挪到末尾,复制一下上面的网址,按shift+ins键(在小键盘旁边),然后按Ctrl+C,然后输入:wq即可。
然后再进行1.3初始化中的两条指令即可:

$ sudo rosdep init
$ rosdep update

此时如果报如下错误:

ERROR: default sources list file already exists:
        /etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize

则使用如下指令将其删掉即可:

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

然后再执行如下指令便没有问题了

$ sudo rosdep init
$ rosdep update

猜你喜欢

转载自blog.csdn.net/WeOnAir/article/details/109221519
今日推荐