ubuntu-18.04一键安装ros

发布时间:2024-11-12 09:01

文章目录

      • 执行命令安装ros
      • 环境配置

之前安装ros的过程中需要,最近我们盖饭的神(鱼香ros)大佬又更新了一键安装ros的工具,我就迫不及待的先来测试一下,首先我的ubuntu-18.04的源已经切换过了,都是国内的源,还是给大家贴一下吧

# deb cdrom:[Ubuntu 18.04.2 LTS _Bionic Beaver_ - Release amd64 (20190210)]/ bionic main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted #Added by software-properties

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ bionic universe multiverse #Added by software-properties
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main universe restricted multiverse #Added by software-properties
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ bionic universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.aliyun.com/ubuntu/ bionic multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse #Added by software-properties
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main universe restricted multiverse #Added by software-properties
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
# deb-src [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
deb http://security.ubuntu.com/ubuntu xenial-security main
# deb-src http://security.ubuntu.com/ubuntu xenial-security main
# deb-src http://security.ubuntu.com/ubuntu xenial-security main



deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse

# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
#deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
#deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
#deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
#deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
#deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse

如果需要更换源,最后别忘了下面命令更新一下

sudo apt-get update

执行命令安装ros

wget http://fishros.com/install -O fishros && . fishros

终端输入上面命令进行安装ros,会自动帮我们检测环境依赖

RUN Choose Task:[请输入括号内的数字]
---众多工具,等君来用---
[1]:一键安装:ROS(支持ROS和ROS2,树莓派Jetson)
[2]:一键安装:github桌面版(小鱼常用的github客户端)
[3]:一键配置:rosdep(小鱼的rosdepc,又快又好用)
[4]:一键配置:ROS环境(快速更新ROS环境设置,自动生成环境选择)
[5]:一键配置:系统源(更换系统源,支持全版本Ubuntu系统)
[6]:一键安装:nodejs开发环境(通过nodejs可以预览小鱼官网噢)
[7]:一键安装:VsCode
[8]:一键安装:Docker
[77]:测试模式:运行自定义工具测试
[0]:quit
请输入[]内的数字以选择:

这里我选择1,然后进到下一个选择项

小鱼:检测当前系统ubuntu18.04:bionic 支持一键安装ROS
RUN Choose Task:[请输入括号内的数字]
如果您是第一次安装,推荐您先更换一下系统源
[1]:更换系统源再继续安装
[2]:不更换继续安装
[0]:quit
请输入[]内的数字以选择:2

因为我的源已经更换过,所以选择2

[1]:melodic
[2]:bouncy
[3]:crystal
[4]:dashing
[5]:eloquent
[0]:quit
请输入[]内的数字以选择:1

ubuntu版本对应安装ros版本如下:

ubuntu版本 Ros版本
Ubuntu14.04 Ingigo
Ubuntu16.04 Kinetic
Ubuntu18.04 Melodic
Ubuntu20.04 Noetic
请选择安装的具体版本:
[1]:melodic完全版
[2]:melodic基础版()
[0]:quit
请输入[]内的数字以选择:

这里我选择的是1,安装完全版,然后回车就进入安装的过程了
安装完后我们还需要初始化一下rosdep,这里继续用大佬的源

RUN Choose Task:[请输入括号内的数字]
---众多工具,等君来用---
[1]:一键安装:ROS(支持ROS和ROS2,树莓派Jetson)
[2]:一键安装:github桌面版(小鱼常用的github客户端)
[3]:一键配置:rosdep(小鱼的rosdepc,又快又好用)
[4]:一键配置:ROS环境(快速更新ROS环境设置,自动生成环境选择)
[5]:一键配置:系统源(更换系统源,支持全版本Ubuntu系统)
[6]:一键安装:nodejs开发环境(通过nodejs可以预览小鱼官网噢)
[7]:一键安装:VsCode
[8]:一键安装:Docker
[77]:测试模式:运行自定义工具测试
[0]:quit
请输入[]内的数字以选择:3

然后回车,配置好后会有如下提示

已为您安装好rosdepc,请使用:
rosdepc update 
进行测试更新,最后欢迎关注微信公众号《鱼香ROS》
一键安装已开源,欢迎给个star/提出问题/帮助完善:https://github.com/fishros/install/ 

我们执行命令更新一下

rosdepc update

至此,ros的安装就完成了

环境配置

环境配置我们最好根据官网教程自己手动配置一下,大佬的工具也是把ros安装在opt目录下

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

现在我们验证一下,打开三个终端,分别执行以下命令

roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key

如下图所示,说明ros安装成功
ubuntu-18.04一键安装ros_第1张图片

如果你觉得启动三个终端太麻烦,也可以写一个启动的脚本 turtlesim.launch

<launch>
    <node pkg="turtlesim" name="turtle1" type="turtlesim_node"/>
    <node pkg="turtlesim" name="turtle1_key" type="turtle_teleop_key"/>
</launch>

这样我们就可以直接在终端执行命令启动

roslaunch  turtlesim.launch

最后再膜拜一下鱼香ros大佬,这个工具太好用了

ItVuer - 免责声明 - 关于我们 - 联系我们

本网站信息来源于互联网,如有侵权请联系:561261067@qq.com

桂ICP备16001015号