1. 程式人生 > 實用技巧 >ubuntu16安裝ROS(包括win10子系統ubuntu同樣能用)

ubuntu16安裝ROS(包括win10子系統ubuntu同樣能用)

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

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

3.sudo apt-get update

4.sudo rosdep init
執行這一步後會基本都會出現website may be down

嘗試過很多網上其他人的部落格方法後,找到的能用的解決辦法:參考連結:http://www.bubuko.com/infodetail-3520310.html

主要如下:

  1. Windows開啟C:/windows/system32/drivers/etc/hosts,追加下面內容後重新整理DNS快取ipconfig /flushdns
  2. Linux開啟/etc/hosts,追加下面內容,無需重新整理快取
  3. Mac開啟/etc/hosts,追加下面內容,使用sudo killall -HUP mDNSResponder重新整理DNS快取
    # GitHub Start
    52.74.223.119     github.com
    192.30.253.119    gist.github.com
    54.169.195.247    api.github.com
    185.199.111.153   assets-cdn.github.com
    151.101.76.133    raw.githubusercontent.com
    151.101.76.133    gist.githubusercontent.com
    151.101.76.133    cloud.githubusercontent.com
    151.101.76.133    camo.githubusercontent.com
    151.101.76.133    avatars0.githubusercontent.com
    151.101.76.133    avatars1.githubusercontent.com
    151.101.76.133    avatars2.githubusercontent.com
    151.101.76.133    avatars3.githubusercontent.com
    151.101.76.133    avatars4.githubusercontent.com
    151.101.76.133    avatars5.githubusercontent.com
    151.101.76.133    avatars6.githubusercontent.com
    151.101.76.133    avatars7.githubusercontent.com
    151.101.76.133    avatars8.githubusercontent.com
    # GitHub End

5.rosdep update
這一步執行後會出現time out
解決辦法,有些用自己手機開個熱點就可以了,手機熱點也不行的話把downLoad_timeout延長就行。
命令如下:
sudo vim /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
在比較靠前的位置有這個downLoad_timeout = 15.0.我把它改到500後再次執行,一次就成功了。

6. echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
7. source ~/.bashrc

8. sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
9. Roscore
10.結束