ubuntu20.04安装noetic版本ros
文章目錄
- 1. ubuntu設置為中文界面
- 2.配置Ubuntu軟件倉庫
- 3.設置sources.list
- 4.設置密鑰
- 5. 安裝ros
- 6. 設置環境
- 7. 測試ROS安裝是否成功
- 8. 初始化rosdep
- 8.1 如/etc/ros/rosdep/sources.list.d目錄存在
- 8.2 /etc/ros/rosdep/sources.list.d目錄不存在
1. ubuntu設置為中文界面
Ubuntu20.04 英文界面換成中文界面
2.配置Ubuntu軟件倉庫
3.設置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'利用 “sh -c” 命令,它可以讓 bash 將一個字串作為完整的命令來執行,這樣就可以將 sudo 的影響范圍擴展到整條命令,這條命令的意思是把"deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main"雙引號中的內容添加到/etc/apt/sources.list.d/ros-latest.list文件中。
4.設置密鑰
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C6545. 安裝ros
安裝之前先執行sudo apt update更新軟件源,我們這里安裝桌面完整版本:
sudo apt install ros-noetic-desktop-full6. 設置環境
你需要在使用ROS的每個bash終端中source這個腳本。
source /opt/ros/noetic/setup.bash而下面這些命令可以在每次啟動新的shell窗口時很方便地為你自動source一下這個腳本
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc source ~/.bashrc7. 測試ROS安裝是否成功
在終端輸入:
roscore 啟動RosMaster
再新建一個終端,輸入:
rosrun turtlesim turtlesim_node
再新建一個終端,輸入:
rosrun turtlesim turtle_teleop_key
8. 初始化rosdep
開始使用ROS之前,先初始化rosdep,rosdep能夠輕松地安裝要編譯的源代碼的系統依賴關系,rosdep是ROS核心組件運行的基礎
rosdep是ros的一個功能包,在安裝ros時會自動安裝.在使用時需要初始化.ros包有兩個不同類型的依賴項:build依賴項和run依賴項。rosdep就是用來檢查包的丟失依賴項,并且完成下載和安裝。
執行sudo rosdep init,提示sudo: rosdep:找不到命令
需要安裝sudo apt-get install python3-rosdep2
然后重新
如果 /etc/ros/rosdep/sources.list.d目錄存在,則只需修改/etc/ros/rosdep/sources.list.d目錄下的文
件,如果/etc/ros/rosdep/sources.list.d目錄不存在,需要手動創建上面所述的目錄:
/etc/ros/rosdep/sources.list.d (當然說的是在etc目錄下…),自己制作20-default.list文件。
8.1 如/etc/ros/rosdep/sources.list.d目錄存在
cd /etc/ros/rosdep/sources.list.d sudo gedit 20-default.list在每一個https://raw.githubusercontent.com/前面添加https://ghproxy.com/
修改好的
改后后執行rosdep update,前面4個網址訪問成功,但最后1個還是訪問,錯誤信息如下:
kandi@ubuntu:/etc/ros/rosdep/sources.list.d$ rosdep update reading in sources list data from /etc/ros/rosdep/sources.list.d Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml ERROR: unable to process source [https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml]:Failed to download target platform data for gbpdistro:<urlopen error [Errno 111] Connection refused> Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml ERROR: error loading sources list:<urlopen error <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml)>提示無法訪問https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml和https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml,此時需要修改index-v4.yaml所在的位置。
需要特別注意:
修改的方法是在下面這些文件中https://raw.githubusercontent.com前面加上https://ghproxy.com/
(1) 修改
(2) 修改在__init__.py文件中修改index-v4.yaml的位置
sudo gedit /usr/lib/python3/dist-packages/rosdistro/__init__.py
繼續rosdep update,但還有出錯的信息:
把下面幾個文件對應的地方也改了
/usr/lib/python3/dist-packages/rosdep2/sources_list.py/usr/lib/python3/dist-packages/rosdep2/rep3.py /usr/lib/python3/dist-packages/rosdistro/manifest_provider/github.py此文件兩個地方需要修改繼續rosdep update,還是有問題,比如:
ERROR: unable to process source [https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml]在多執行幾次rosdep update就ok了,信息如下:
kandi@ubuntu:~$ rosdep update reading in sources list data from /etc/ros/rosdep/sources.list.d Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml Hit https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml Query rosdistro index https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml Skip end-of-life distro "ardent" Skip end-of-life distro "bouncy" Skip end-of-life distro "crystal" Skip end-of-life distro "dashing" Skip end-of-life distro "eloquent" Add distro "foxy" Add distro "galactic" Skip end-of-life distro "groovy" Skip end-of-life distro "hydro" Skip end-of-life distro "indigo" Skip end-of-life distro "jade" Skip end-of-life distro "kinetic" Skip end-of-life distro "lunar" Add distro "melodic" Add distro "noetic" Add distro "rolling" updated cache in /home/kandi/.ros/rosdep/sources.cache8.2 /etc/ros/rosdep/sources.list.d目錄不存在
手動創建上面所述的目錄: /etc/ros/rosdep/sources.list.d ,自己創建20-default.list文件。
在終端輸入
在gedit 20-default.list上粘貼下面的內容:
#os-specific listings first yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx #generic yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml gbpdistro https://ghproxy.com/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總結
以上是生活随笔為你收集整理的ubuntu20.04安装noetic版本ros的全部內容,希望文章能夠幫你解決所遇到的問題。