ubuntu18安裝ros

記錄Ubuntu18安裝ros系統

一、換阿里源

換阿里源鏈接

二、配置軟件和更新設置

爲了能順利更新
這裏我電腦連接手機開的網絡熱點
在這裏插入圖片描述

三、開始安裝

參考wiki進行安裝ros安裝官網
注意這裏安裝過程全程用手機熱點

  1. Setup your 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'
    
  2. Set up your keys

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

    sudo apt update
    
    sudo apt install ros-melodic-desktop-full
    

    開始安裝ros
    在這裏插入圖片描述如果有提示下載失敗,爲網絡問題,重新執行一次命令即可。

  4. Initialize rosdep

     sudo rosdep init
    

    安裝停在了這裏
    在這裏插入圖片描述這裏給出我的解決辦法來代替sudo rosdep init

    保證網絡暢通打開這個提示網址:
    https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
    在這裏插入圖片描述複製這段內容

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

    終端執行命令手動創建文件

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

    將內容粘貼保存,問題解決。
    在這裏插入圖片描述
    接下來執行命令

    rosdep update
    

    如果出現網絡錯誤請重新輸入命令直到成功
    在這裏插入圖片描述
    在這裏插入圖片描述

  5. Environment setup

    echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
    
    source ~/.bashrc
    
  6. Dependencies for building packages

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

到此ros機器人系統安裝成功!

四、運行小烏龜

roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key 

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章