ROS安裝(國內源)

1.添加源

1.1 USTC源

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'

如執行有問題,則:html

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

1.2 TUNA源

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'

注:配合http://www.javashuo.com/article/p-qumnkkio-bh.html所提到的更換Ubuntu系統源,安裝速度非國外源可比。python

2.添加私鑰

wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -

如不能添加,則:git

sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116

3.更新軟件列表

sudo apt-get update

注意:通常無需使用sudo apt-get upgrade這個命令,會把本地已安裝的軟件,與剛下載的軟件列表裏對應軟件進行對比,若是發現已安裝的軟件版本過低,就會提示你更新。而sudo apt-get update這個命令,只是訪問源列表裏的每一個網址讀取軟件列表,而後保存在本地電腦。github

3.1 GPG 錯誤

W: GPG 錯誤:http://mirrors.ustc.edu.cn/ros/ubuntu xenial InRelease: 因爲沒有公鑰,沒法驗證下列簽名: NO_PUBKEY F42ED6FBAB17C654

錯誤緣由:

多是缺乏公鑰,也多是公鑰過時。ubuntu

解決方法:

既然是沒有公鑰,天然是添加公鑰。ruby

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

3.2 404 Not Found錯誤

W: 倉庫 「http://ppa.launchpad.net/tualatrix/ppa/ubuntu xenial Release」 沒有 Release 文件。
N: 沒法認證來自該源的數據,因此使用它會帶來潛在風險。
N: 參見 apt-secure(8) 手冊以瞭解倉庫建立和用戶配置方面的細節。
W: 沒法下載 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/binary-amd64/Packages  404  Not Found [IP: 91.189.95.83 80]
W: 沒法下載 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/binary-i386/Packages  404  Not Found [IP: 91.189.95.83 80]
W: 沒法下載 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/binary-all/Packages  404  Not Found [IP: 91.189.95.83 80]
W: 沒法下載 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/i18n/Translation-zh_CN  404  Not Found [IP: 91.189.95.83 80]
W: 沒法下載 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/i18n/Translation-zh  404  Not Found [IP: 91.189.95.83 80]
W: 沒法下載 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/i18n/Translation-en  404  Not Found [IP: 91.189.95.83 80]
W: 沒法下載 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/dep11/Components-amd64.yml  404  Not Found [IP: 91.189.95.83 80]
W: 沒法下載 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/dep11/icons-64x64.tar  404  Not Found [IP: 91.189.95.83 80]
W: 部分索引文件下載失敗。若是忽略它們,那將轉而使用舊的索引文件。

錯誤緣由:

首先說明此問題與ROS安裝無關。bash

緣由多是PPA源中此用戶刪除了這些文件,但又添加了此源。工具

解決方法:

打開/etc/apt/sources.list.d文件夾,刪除相關源文件。測試

4.安裝ROS

sudo apt-get install ros-kinetic-desktop-full

注意:fetch

  1. 按需選用full或者是base,base沒有圖形化界面,適合安裝在機器人上;
  2. 按照Ubuntu版本選擇ROS版本,kinetic版本適合於Ubuntu 16.04,其餘Ubuntu版本各有其相應的ROS版本,不建議混用。
  3. 安裝完成後,能夠用下面的命令來查看可以使用的包
    apt-cache search ros-kinetic

5.初始化

sudo rosdep init
rosdep update

可能出現問題:

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.

解決方案:

多試幾回!國內鏈接githubsercontent.com比較慢,容易失敗。

若是屢次嘗試未果,能夠嘗試以下方法:

http://www.javashuo.com/article/p-uzcpsfza-kd.html

下面提供我我的設置的文件:

  1. 原始20-default.list:https://hansteam.coding.net/p/rosdeap_mirror/d/rosdeap_mirror/git/raw/master/20-default.list
  2. 修改後的20-default.list文件:
    #Rewrited by HAN_Letisl
    #For more information: https://www.cnblogs.com/letisl
    
    # os-specific listings first
    yaml https://hansteam.coding.net/p/rosdeap_mirror/d/rosdeap_mirror/git/raw/master/osx-homebrew.yaml osx
    
    # generic
    yaml https://hansteam.coding.net/p/rosdeap_mirror/d/rosdeap_mirror/git/raw/master/base.yaml
    yaml https://hansteam.coding.net/p/rosdeap_mirror/d/rosdeap_mirror/git/raw/master/python.yaml
    yaml https://hansteam.coding.net/p/rosdeap_mirror/d/rosdeap_mirror/git/raw/master/ruby.yaml
    gbpdistro https://hansteam.coding.net/p/rosdeap_mirror/d/rosdeap_mirror/git/raw/master/fuerte.yaml fuerte
    
    # newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

    注意:其Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml在20-default.list不顯式出現,所以未能將這個文件包括在其中,我的鏡像中有這個文件(https://hansteam.coding.net/p/rosdeap_mirror/d/rosdeap_mirror/git/raw/master/index-v4.yaml),須要使用的朋友能夠自行設法使用。

備註:徹底正確的結果圖,供參考。

 

 

6.環境配置

#echo 「source /opt/ros/kinetic/setup.bash」 >> ~/.bashrc 這個命令是錯誤的,勿用。引號是中文引號,與下一條對比。
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc source
~/.bashrc

可能出現問題:

「source:未找到命令

問題緣由:

根據提示,打開/.bashrc文件:

」source /opt/ros/kinetic/setup.bash「

發現最後一行竟然多了兩側的引號,並且是中文引號。

緣由在於,上述命令中的引號問題。

7.安裝rosinstall

sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential

8.測試是否安裝成功

roscore

若是顯示以下:

started core service [/rosout]

表明安裝成功。

9.安裝IDE

RoboWare Studio是ROS的一款IDE,可是它的功能又比較強大,使得開發更加快速、簡單。這款軟件適合菜鳥入門,由於不少配置都直接自動生成。

直接進入其中文官網,http://cn.roboware.me/#/home,下載deb包安裝便可。

9.1安裝包

事實上,中文官網彷佛用了XX工具也不能打開。

提供我的下載連接:roboware-studio_1.1.0-1514335284_amd64.deb:https://hansteam.coding.net/s/ffc0144b-9c57-4173-974a-ba03986d2719

9.2預先安裝

安裝pyint用於支持Python調試功能:

sudo apt-get install python-pip
sudo python -m pip install pylint

備註:若是出現問題,可參照:

https://blog.csdn.net/zhuiqiuzhuoyue583/article/details/84536406

簡單講,能夠:

  1. 執行sudo apt-get install python-pip
  2. sudo gedit /usr/bin/pip,修改成:
    #!/usr/bin/python
    # GENERATED BY DEBIAN
    
    import sys
    
    # Run the main entry point, similarly to how setuptools does it, but because
    # we didn't install the actual entry point from setup.py, don't use the
    # pkg_resources API.
    from pip import __main__
    if __name__ == '__main__':
        sys.exit(__main__._main())
    #modify when install roboware @hans,2019.11.8
    #from pip import main
    #if __name__ == '__main__':
    #    sys.exit(main())
  3. pip install --upgrade pip
  4. sudo pip install --ignore-installed enum34
  5. sudo python -m pip install pylint

安裝clang-format得到更好的代碼閱讀體驗,自動格式化整理代碼:

sudo apt-get install clang-format-3.8

9.3正式安裝

sudo dpkg -i roboware-studio_1.1.0-1514335284_amd64.deb

安裝完畢後:

roboware-studio

輸入以上命令,便可打開該IDE使用。

參考資料:RoboWare_Studio_Manual_1.1.0_CHS.pdf

也可使用最新版:roboware-studio_1.2.0-1524709819_amd64.debRoboWare_Studio_Manual_1.2.0_CHS.pdf

參考資料

更多內容,詳見:http://wiki.ros.org/kinetic/Installation/Ubuntu

相關文章
相關標籤/搜索