ubuntu18.04安装ROS Melodic(亲测踩坑)

ubuntu18.04安装ROS Melodic(最详细配置)

1,更换服务器为清华镜像!
ubuntu18.04安装ROS Melodic(亲测踩坑)_第1张图片2,设置软件源:(国内的快)

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

3,设置最新的密钥:

官方最新密钥

4,安装:

sudo apt-get update
sudo apt-get install ros-melodic-desktop-full

5,初始化rosdep:

sudo rosdep init
rosdep update

这里可能会出现如下报错:
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.
解决方法:

sudo gedit /etc/resolv.conf

将里面的内容替换为下面的内容:

nameserver 8.8.8.8 #google域名服务器
nameserver 8.8.4.4 #google域名服务器

保存后重复命令:

sudo rosdep init
rosdep update

6,设置环境变量:

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc

7,安装编译依赖:

sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential

8, 小海龟案例测试:
打开第一个终端:

roscore

打开第二个终端:

rosrun turtlesim turtlesim_node

至此成功起飞!OK!

你可能感兴趣的:(ubuntu,ROS)