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
Error with second command:
https://blog.csdn.net/u013468614/article/details/102917569
https://www.jianshu.com/p/bdbfbac69114
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