Ubuntu18.04下ROS Melodic安装

本文提供了一步一步的指导来帮助读者在Ubuntu系统上安装ROS(机器人操作系统),包括添加软件源、密钥,安装ROS桌面完整版及必要的构建工具,并通过一个简单的实例验证安装的成功。
摘要由CSDN通过智能技术生成

1 添加ROS软件源

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

 为了提高软件的下载、安装速度,也可以使用以下任意一种国内的镜像源:

中国科学技术大学(USTC)镜像源:

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'

 中山大学(Sun Yat-Sen University)镜像源:

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

 易科机器人实验室(ExBot Robotics Lab)镜像源:

sudo sh -c '. /etc/lsb-release && echo "deb http://ros.exbot.net/rospackage/ros/ubuntu $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

 

2 添加密钥

2.1 修改hosts

        国内访问raw.githubusercontent.com可能不成功,对此,以下方式可解决GitHub的raw.githubusercontent.com无法连接的问题。

step-1:

        在 ip查询 查ip 网站ip查询 同ip网站查询 iP反查域名 iP查域名 同ip域名

        输入raw.githubusercontent.com查询IP地址

3f00bcdf261b4fbf88ec5f675bfe7bc4.png

 step-2:

        修改hosts,ip用上面查到的(一个不行换另一个)。vim /etc/hosts 加入

185.199.108.133 raw.githubusercontent.com

2.2 添加密钥

sudo apt install curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

2.3 更新源

sudo apt update

3 安装ROS

        ROS安装可选 ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators和2D/3D perception。这里我们全都要。

sudo apt install ros-melodic-desktop-full

 4 配置环境

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

5 安装ROS构建包

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

安装rosdep

sudo apt install python-rosdep

6 运行实例检测ROS是否安装成功

6.1 一个窗口终端运行roscore

roscore

cf2b46fe72bd47d3bdd0e8c58b1d65ce.png

  6.2 另一个窗口终端启动海龟仿真器

rosrun turtlesim turtlesim_node

4a262709ca28419c87c54ebb66c50dc8.png

 6.3 另开一个窗口终端用键盘控制小乌龟移动

rosrun turtlesim turtle_teleop_key

41bb691122d240b6a141d07e4d2cc0b2.png

        这样,在该终端操作键盘的上下左右方向键,就可以控制乌龟移动。

400946203e874f8abf6908fcf3dd3954.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值