ubutu18.04下Ros melodic安装教程

ubutu18.04下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/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'

或来自国内清华的安装源

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

PS:回车后,可能需要输入管理员密码
2 设置key

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

3 更新

sudo apt update

4 安装

sudo apt install ros-melodic-desktop-full

出现错误
在这里插入图片描述
解决方案
在其他位置/etc/apt/sources.lst中开启以下权限,打对号
或者直接在系统中搜索软件和更新亦可
在这里插入图片描述
在这里插入图片描述
5 环境设置

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

6 安装依赖

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

7 初始化rosdep

sudo apt install python-rosdep
sudo rosdep init
rosdep update

出现错误
在这里插入图片描述
解决方案
首先查询网站真实ip地址,通过通过IPAddress.com首页,输入raw.githubusercontent.com查询到真实IP地址。

sudo gedit /etc/hosts

最后一行添加以下内容保存即可

(你所查询到的ip地址)  raw.githubusercontent.com

在这里插入图片描述
在这里插入图片描述
解决GitHub的raw.githubusercontent.com无法连接问题

sudo vi /etc/hosts

添加以下内容保存即可 (IP地址查询后相应修改,可以ping不同IP的延时 选择最佳IP地址)

GitHub Start

52.74.223.119 github.com
192.30.253.119 gist.github.com
54.169.195.247 api.github.com
185.199.111.153 assets-cdn.github.com
151.101.76.133 raw.githubusercontent.com
151.101.108.133 user-images.githubusercontent.com
151.101.76.133 gist.githubusercontent.com
151.101.76.133 cloud.githubusercontent.com
151.101.76.133 camo.githubusercontent.com
151.101.76.133 avatars0.githubusercontent.com
151.101.76.133 avatars1.githubusercontent.com
151.101.76.133 avatars2.githubusercontent.com
151.101.76.133 avatars3.githubusercontent.com
151.101.76.133 avatars4.githubusercontent.com
151.101.76.133 avatars5.githubusercontent.com
151.101.76.133 avatars6.githubusercontent.com
151.101.76.133 avatars7.githubusercontent.com
151.101.76.133 avatars8.githubusercontent.com

GitHub End
link.
针对sudo rosdep init异常的最终有效解决方案:
错误提示:

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.

原因:
境外资源被屏蔽
解决思路:
查询错误提示中域名的IP地址,然后修改 /etc/hosts 文件,添加域名与IP映射
实现:
1.访问域名查询网址:https://site.ip138.com/
2.查询域名ip,搜索框中输入: raw.githubusercontent.com,自由复制一个查询到的IP

如果rosdep update不稳定,就多尝试几次
在这里插入图片描述
二 ros安装成功后基于简单案例进行验证

roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key

三 ros相关包的安装与查询
安装:

sudo apt install ros-melodic-PACKAGE

如:

sudo apt install ros-melodic-slam-gmapping

查询:

apt search ros-melodic

四 链接参考
1 ros安装教程
链接: 官网.
链接: 创客智造.
2 链接: ros melodic安装出错博客参考.
3 链接: rosdep init安装失败知乎参考.
4 Autolabor在bilibili上的ros视频对应文档

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

星辰和大海都需要门票

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值