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 

在这里插入图片描述

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