1.設置系統源
deb http://mirrors.aliyun.com/ubuntu-ports/ bionic main restricted universe multiverse
注:ubuntu-ports
2.sudo apt-get update
3.配置ROS源
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
4.更新
sudo apt-get update
5.安裝ros
sudo apt install ros-melodic-desktop-full
6.初始化rosdep
sudo rosdep init
rosdep update
注:第一句失敗的話執行
sudo apt install python-rosdep
7.設置環境變量
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
8.安裝rosinstall
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
9.驗證ros
roscore
注:失敗的話再次執行
sudo apt-get -f install ros-melodic-desktop-full
參考:
1.https://www.ncnynl.com/archives/201906/3147.html
2.https://blog.csdn.net/weixin_40772628/article/details/103377637