ubunt18.04安装ROS2

本文无废话,实现了ubunt18.04 下ros2的安装,并且同时兼容ros和ros2
如果想完ros(1)的,请参考我的前一篇文章:ubunt18.04安装ROS避坑指南
参考:

https://blog.csdn.net/cau_weiyuhu/article/details/128666548
https://blog.csdn.net/ZhangRelay/article/details/114762734

得到一个重要信息ROS2的镜像这里有:

https://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu/

搞到这个,离成功就不远了;

重要步骤:

添加ros2 软件源

注意apt-key的网址

sudo apt install curl gnupg2
curl http://repo.ros2.org/repos.key | sudo apt-key add -
sudo apt update

注意ros2的网址

 sudo sh -c 'echo "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu/  bionic main" > /etc/apt/sources.list.d/ros2-latest.list'

安装ros-eloquent和相关依赖

开始更新和安装

sudo apt update
sudo apt install ros-eloquent-desktop

注意:18.04下对应的ros版本是melodic,ros2是eloquent

安装python3库

sudo apt install -y libpython3-dev python3-pip
pip3 install -U argcomplete

这个安装了一半跳过了

sudo apt install ros-eloquent-rmw-connext-cpp

ROS和ros2

若ros2单独存在

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

ROS1和ROS2共存
在~.bashrc中添加如下代码,前提你得时ubunt18.04,且安装了两个版本

#source /opt/ros/melodic/setup.bash
#source /opt/ros/eloquent/setup.bash
 echo "ros melodic(1) or ros2 eloquent(2)?"
 read edition
 ps=$PS1
 if [ "$edition" -eq "1" ]; then
   source /opt/ros/melodic/setup.bash
   # echo "ros melodic(1) has been chosen!"
   PS1="(ros1-melodic:)$ps"
 else
   source /opt/ros/eloquent/setup.bash
   # echo "ros2 eloquent(2) has been chosen!"
   PS1="(ros2-eloquent)$ps"
 fi

ROS2依赖配置

fang@fang-inspiron-5580:/etc/apt/sources.list.d$ sudo rosdepc init
您已经成功安装rosdepc,下面提示的用法中,请将rosdep替换为rosdepc使用~
欢迎使用国内版rosdep之rosdepc,我是作者小鱼!
学习机器人,就关注《鱼香ROS》(公众号|B站|CSDN)!
小鱼rosdepc正式为您服务
Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run

	rosdep update

---------------------------------------------------------------------------
小鱼提示:恭喜你完成初始化,快点使用

 rosdepc update

更新吧
---------------------------------------------------------------------------
小鱼科普:rosdep干什么用的?可以跳过吗?https://fishros.org.cn/forum/topic/2124
如果再使用过程中遇到任何问题,欢迎通过fishros.org.cn反馈,或者加入QQ交流群(139707339)
fang@fang-inspiron-5580:/etc/apt/sources.list.d$ rosdepc update
您已经成功安装rosdepc,下面提示的用法中,请将rosdep替换为rosdepc使用~
欢迎使用国内版rosdep之rosdepc,我是作者小鱼!
学习机器人,就关注《鱼香ROS》(公众号|B站|CSDN)!
小鱼rosdepc正式为您服务
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://mirrors.tuna.tsinghua.edu.cn/github-raw/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://mirrors.tuna.tsinghua.edu.cn/github-raw/ros/rosdistro/master/rosdep/base.yaml
Hit https://mirrors.tuna.tsinghua.edu.cn/github-raw/ros/rosdistro/master/rosdep/python.yaml
Hit https://mirrors.tuna.tsinghua.edu.cn/github-raw/ros/rosdistro/master/rosdep/ruby.yaml
Query rosdistro index https://mirrors.tuna.tsinghua.edu.cn/rosdistro/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Skip end-of-life distro "dashing"
Skip end-of-life distro "eloquent"
Skip end-of-life distro "foxy"
Skip end-of-life distro "galactic"
Skip end-of-life distro "groovy"
Add distro "humble"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Add distro "iron"
Skip end-of-life distro "jade"
Skip end-of-life distro "kinetic"
Skip end-of-life distro "lunar"
Skip end-of-life distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /home/fang/.ros/rosdep/sources.cache
---------------------------------------------------------------------------
小鱼恭喜:rosdepc已为您完成更新!!
---------------------------------------------------------------------------
小鱼科普:rosdep干什么用的?可以跳过吗?https://fishros.org.cn/forum/topic/2124
如果再使用过程中遇到任何问题,欢迎通过fishros.org.cn反馈,或者加入QQ交流群(139707339)

安装colcon编译工具

sudo apt-get install python3-colcon-ros

运行经典小乌龟

fang@fang-inspiron-5580:~$ sudo apt install ros-eloquent-turtlesim
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ros-eloquent-turtlesim is already the newest version (1.1.2-1bionic.20201207.164444).
ros-eloquent-turtlesim set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.


fang@fang-inspiron-5580:~$ ros2 pkg executables turtlesim
turtlesim draw_square
turtlesim mimic
turtlesim turtle_teleop_key
turtlesim turtlesim_node


fang@fang-inspiron-5580:~$ ros2 run turtlesim turtlesim_node
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqeglfs.so"
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqeglfs.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "eglfs"

在切出来另外一个终端,会让选择使用ros还是ros2

ros melodic(1) or ros2 eloquent(2)?
2
(ros2-eloquent)fang@fang-inspiron-5580:~$ 
(ros2-eloquent)fang@fang-inspiron-5580:~$ 
(ros2-eloquent)fang@fang-inspiron-5580:~$ 
(ros2-eloquent)fang@fang-inspiron-5580:~$ 
(ros2-eloquent)fang@fang-inspiron-5580:~$ ros2 run turtlesim turtle_teleop_key
Reading from keyboard
---------------------------
Use arrow keys to move the turtle.
Use G|B|V|C|D|E|R|T keys to rotate to absolute orientations. 'F' to cancel a rotation.
'Q' to quit.

这样就可以控制ROS2的小龟了
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/557661.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Ubuntu20.04版本命令行设置挂载磁盘,并设置开机自动挂载

最近部署应用 系统是Ubuntu20.4版本的Linux系统,加了数据盘,需要格式化后挂载,记录下: Linux 数据盘挂载(采用 parted 分区工具)-格式化为 ext4 1. 初始化 Linux 数据盘 挂载数据盘后或者随实例创建时一并创建的数据盘&#xff…

【数学建模】最优旅游城市的选择问题:层次分析模型(含MATLAB代码)

层次分析法(The analytic hierarachy process,简称AHP)是一种常用的决策分析方法,其基本思路是将复杂问题分解为多个组成部分,然后对这些部分进行逐一评估和比较,最后得出最优解决方案。(例如&a…

Linux 5.10 Pstore 学习之(二) 原理学习

目录 编译框架模块初始化pstore子系统ramoops模块初始化实例化注册回调数据结构 pstore_blk模块pstore_zone模块 测试扩展调试 编译框架 目标结构 linux_5.10/fs/pstore/ ├── blk.c ├── ftrace.c ├── inode.c // 核心1 ├── internal.h ├── Kconfig ├── …

Vitis HLS 学习笔记--scal 函数-探究

目录 1. Vitis HLS重器-Vitis_Libraries 2. 初识scal() 3. 函数具体实现 3.1 变量命名规则 3.2 t_ParEntries解释 3.3 流类型详解 3.4 双重循环 4. 总结 1. Vitis HLS重器-Vitis_Libraries 在深入探索Vitis HLS(High-Level Synthesis)的旅程中&…

了解 containerd 中的 snapshotter,先从 native 开始

本文内容节选自 《containerd 原理剖析与实战》,本书正参加限时优惠内购,点击阅读原文,限时 69.9 元购买。 上一篇文章《一文了解 containerd 中的 snapshot》中,介绍了containerd 的 snapshot 机制,了解到 containerd…

64B/66B编码 自定义PHY层设计

一、前言 之前的一篇文章讲解了64B/66B的基本原理,本篇在基于64B/66B GT Transceiver的基础之上设计自定义PHY。基本框图如下。 二、GT Mdule GT Module就按照4个GT CHannel共享一个GT COMMON进行设置,如下图。要将例子工程中的GT COMMON取出&#xff…

3.4 海思SS928开发 - 烧写工具 - BurnTool Emmc 烧写

3.4 烧写工具 - BurnTool Emmc 烧写 BurnTool 工具提供了多种烧写方式,这里只介绍最常用的 烧写emmc方式。 环境准备 PC 与单板之间连接好调试串口以及网线。 将厂商提供的出厂镜像拷贝至 PC 硬盘上,解压后得到的文件如下: . ├── boot_…

解决Ubuntu安装NVIDIA显卡驱动导致的黑屏问题

前言 本文是在经历了3天内5次重装Ubuntu系统后写下的,根本原因就是这篇文章的主题——安装NVIDIA显卡驱动!写下本文是为了让自己今后不再出同样类型的错误,同时,给其他出现同样问题的人一些启发! 本文实例的电脑配置如…

WEB前端-笔记(二)

一、事件 1.1类型 focus 获取焦点事件 ipt.addEventListener("focus", () > {.log("") }) blue 失去焦点事件 ipt.addEventListener("blur", () > {console.log("") }) inout 文本输入事件 txt.addEventListener("i…

实在智能协办2024中国核能行业RPA数字员工专项培训会

2024年中国核能行业RPA数字员工专项培训会于4月16日-19日在杭州举办,由中国核能行业协会信息化专业委员会主办、实在智能承办。本次培训由理论讲解、技术深化和实际操作三部分组成,旨在帮助核能行业从业人员学习与掌握基于大模型的RPA技术应用&#xff0…

NVIDIA NCCL 源码学习(十四)- NVLink SHARP

背景 上节我们介绍了IB SHARP的工作原理,进一步的,英伟达在Hopper架构机器中引入了第三代NVSwitch,就像机间IB SHARP一样,机内可以通过NVSwitch执行NVLink SHARP,简称nvls,这节我们会介绍下NVLink SHARP如…

使用 Meta Llama 3 构建人工智能的未来

使用 Meta Llama 3 构建人工智能的未来 现在提供 8B 和 70B 预训练和指令调整版本,以支持广泛的应用 使用 Meta AI 体验 Llama 3 我们已将 Llama 3 集成到我们的智能助手 Meta AI 中,它扩展了人们完成工作、创造和与 Meta AI 联系的方式。通过使用 Meta AI 进行编码任务和解…

从零到一品牌电商私域流量代运营规划方案

【干货资料持续更新,以防走丢】 从零到一品牌电商私域流量代运营规划方案 部分资料预览 资料部分是网络整理,仅供学习参考。 PPT共50页(完整资料包含以下内容) 目录 私域运营方案: 一、项目背景与目标 - 开创数智化…

华为路由器基于接口限速

一、背景 ISP与企业内网通过华为路由器接入Internet时,当大量流量进入路由器时,可能会因为带宽不足产生拥塞,导致丢包,严重影响用户上网体验。对于此需要对网络流量进行限制,其方式通常有防火墙带宽策略、路由器基于接口限速等。 二、华为路由器基于接口限速方式 在路由…

Docker 部署 MongoDB 数据库

文章目录 官网地址docker 网络mongod.conf部署 MongoDB部署 mongo-expressdocker-compose.ymlMongoDB shell 官网地址 https://www.mongodb.com/zh-cn docker 网络 # 创建 mongo_network 网络 docker network create mongo_network # 查看网络 docker network list # 容器连…

RT-Thread在Win10下编译出现 unsupported pickle protocol: 5解决方案

调试背景: 在WIN10下编译RT-Thread源码:对象处理器平台是Microchip SAMA5D27-SOM1-EK评估板。 unsupported pickle protocol: 5 编译出现报错:ValueError : unsupported pickle protocol: 5 $ scons scons: Reading SConscript files ... Newlib ver…

MySQL:执行一条查询语句期间发生了什么?

MySQL的架构分为两层,Server 层和存储引擎层 server层负责建立连接、分析和执行SQL,MySQL,MySQL大多数的核心功能模块都在在这里实现,下图上半部分都是server层做的事情,另外,所有的内置函数(如…

在mini2440上编写linux应用程序、字符设备驱动程序的编写与编译

在mini2440上编写linux应用程序 结合前两篇的学习,一个linux操作系统已经在mini2440上运行起来了,结合交叉编译环境和nfs等工具,我们可以在mini2440上编写任何我们在linux系统编程中学到的应用程序。一个简要的多文件Makefile文件如下&#…

设计模式——2_9 模版方法(Template Method)

人们往往把任性也叫做自由,但是任性只是非理性的自由,人性的选择和自决都不是出于意志的理性,而是出于偶然的动机以及这种动机对感性外在世界的依赖 ——黑格尔 文章目录 定义图纸一个例子:从文件中获取信息分几步?Rea…

基于Spingboot+vue协同过滤音乐推荐管理系统

项目演示视频效果: 基于Spingbootvue协同过滤音乐推荐管理系统 基于Spingbootvue协同过滤音乐推荐管理系统 1、项目介绍 基于Springboot的音乐播放管理系统总共两个角色,用户和管理员。用户使用前端前台界面,管理员使用前端后台界面。 有推荐…