記錄Ubuntu18安裝ros系統
一、換阿里源
二、配置軟件和更新設置
爲了能順利更新
這裏我電腦連接手機開的網絡熱點
三、開始安裝
參考wiki進行安裝ros安裝官網
注意這裏安裝過程全程用手機熱點
-
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'
-
Set up your keys
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
-
Installation
sudo apt update
sudo apt install ros-melodic-desktop-full
開始安裝ros
如果有提示下載失敗,爲網絡問題,重新執行一次命令即可。 -
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
如果出現網絡錯誤請重新輸入命令直到成功
-
Environment setup
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
-
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