在樹莓派自帶系統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
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/187178.html
標籤:其他
