ROS 在 Ubuntu 18.04 安裝


配置 Ubuntu 存儲庫

Ubuntu 存儲庫配置為允許"restricted"、"universe"和"multiverse"

   

設置源列表

將計算機設置為接受packages.ros.org的軟件。

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

   

設置密鑰

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

   

安裝

首先,請確保您的 Debian 包索引是最新的:

sudo apt update

   

ROS 中有很多不同的庫和工具。我們提供了四個默認配置來幫助您入門。您還可以單獨安裝 ROS 包。

桌面全安裝:(推薦): ROS rqt rviz,機器人通用庫, 2D/3D 模擬器和 2D/3D 感知

sudo apt install ros-melodic-desktop-full

桌面安裝:ROSrqtrviz和機器人通用庫

sudo apt install ros-melodic-desktop

   

ROS-Base (裸骨)ROS 包、生成和通信庫。無 GUI 工具。

sudo apt install ros-melodic-ros-base

   

單個包:您還可以安裝特定的 ROS 包(用包名稱的破折號替換下划線):

sudo apt install ros-melodic-PACKAGE

例如。

sudo apt install ros-melodic-slam-gmapping

   

要查找可用包,請使用:

apt search ros-melodic

   

   

環境設置

如果每次啟動新 shell 時都會自動將 ROS 環境變量添加到 bash 會話中,則這樣做很方便:

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc

source ~/.bashrc

如果安裝了多個 ROS 分發,則*/.bashrc必須只為當前使用的版本提供setup.bash。

如果只想更改當前 shell 的環境,可以鍵入:

source /opt/ros/melodic/setup.bash

   

生成包的依賴項

到目前為止,您已經安裝了運行核心 ROS 包所需的內容。要創建和管理自己的 ROS 工作區,可以單獨分發各種工具和要求。例如,rosinstall是一個常用的命令行工具,使您能夠使用一個命令輕松下載許多 ROS 包的源樹。

要安裝此工具和其他用於構建 ROS 包的依賴項,請運行:

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

   

初始化 rosdep

在可以使用許多 ROS 工具之前,您需要初始化rosdep。rosdep 使您能夠輕松為要編譯的源安裝系統依賴項,並且需要在 ROS 中運行某些核心組件。如果您尚未安裝 rosdep,請按照以下方式操作。

sudo apt install python-rosdep

   

使用以下功能,您可以初始化 rosdep。

   

sudo rosdep init

rosdep update

   

Q&A:

錯誤描述:

ming@ming:~$ rosdep update

reading in sources list data from /etc/ros/rosdep/sources.list.d

ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml]:

    <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml)

ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml]:

    <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml)

ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml]:

    <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml)

ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml]:

    <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml)

Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml

Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml

Add distro "ardent"

ERROR: error loading sources list:

    <urlopen error <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/ardent/distribution.yaml)>

   

   

解決方法:

sudo gedit /etc/resolv.conf

將原有的nameserver這一行注釋,並添加以下兩行:

nameserver 8.8.8.8

nameserver 8.8.4.4

   

保存退出,執行

sudo  apt-get update

rosdep update

   


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM