ROS安装和卸载 (melodic)
安装ROS
1.安装源
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
或者中国的源
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'
2.设置key
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
3.更新
sudo apt-get update
4.安装
这里介绍Desktop-Full安装: (Recommended) : ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception 和 安装rosinstall,便利的工具
sudo apt-get install ros-melodic-desktop-full
5.安装便捷工具
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential sudo apt uninstall python-rosdep
6.解决依赖
sudo rosdep init rosdep update
7.环境设置
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc source ~/.bashrc
8.安装python版本rospkg
sudo apt install python-pip pip install rospkg
rosdep update出错解决方案:
sudo gedit /etc/resolv.conf #将原有的nameserver这一行注释,并添加以下两行: nameserver 8.8.8.8 #google域名服务器 nameserver 8.8.4.4 #google域名服务器 sudo apt-get update #保存退出,执行 sudo rosdep init #再执行
卸载ROS
sudo apt-get remove ros-melodic-*