ROS melodic版本安装及问题总结
安装步骤
- 添加ROS软件源
sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main"> /etc/apt/sources.list.d/ros-latest.list'
- 添加密钥
apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
- 安装ROS
apt update
apt install ros-melodic-desktop-full
- 初始化rosdep
rosdep init
rosdep update
错误1:
rosdep init找不到命令
解决
sudo apt install python-rosdep2
错误2:
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.
由于https://raw.githubusercontent.com被墙无法访问,我们可以查询它的IP并添加到Host中
打开https://site.ip138.com/ 并查询
选择一个IP,接下来打开终端,输入
sudo vi /etc/hosts
输入i键进行编辑,插入以下一行内容
前面的IP为你选的IP,如果还是不行,可以多换几个试试。
按esc,再输 :wq保存退出。
如果还一直显示The read operation timed out,还可以作如下修改
sudo vim /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
找到DOWNLOAD_TIMEOUT = 15.0,将15.0改得大一点即可。
- 设置环境变量
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
- 安装rosinstall
apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
错误3:
运行至
roscore
命令时,发生错误
Command ‘roscore’ not found,but can be installed with:
sudo apt install python-roslaunch
解决
安装ros-melodic-desktop解决
sudo apt-get install ros-melodic-desktop