菜鸡的ROS学习笔记(image_transport)

2023-05-16

菜鸡的ROS学习笔记(image_transport)

image_transport

这一部分是搬运的ROS wiki中的介绍,主要是image_transport这个包的用法,之后我会把它尽量翻译成中文,希望各位大佬指教

Overview

When working with images we often want specialized transport strategies, such as using image compression or streaming video codecs. image_transport provides classes and nodes for transporting images in arbitrary over-the-wire representations, while abstracting this complexity so that the developer only sees sensor_msgs/Image messages.

Specialized transports are provided by plugins. image_transport itself provides only “raw” transport so as not to impose unnecessary dependencies on client packages. Other transports will only be available if they are built on your system. On Ubuntu, the ros--base debians include the “compressed” and “theora” transports provided by the image_transport_plugins stack.

Quickstart Guide

image_transport should always be used to publish and subscribe to images. At this basic level of usage, it is very similar to using ROS Publishers and Subscribers. Using image_transport instead of the ROS primitives, however, gives you great flexibility in how images are communicated between nodes.

For complete examples of publishing and subscribing to images using image_transport, see the Tutorials.

C++ Usage

Instead of:

/ Do not communicate images this way!
#include <ros/ros.h>

void imageCallback(const sensor_msgs::ImageConstPtr& msg)
{
  // ...
}

ros::NodeHandle nh;
ros::Subscriber sub = nh.subscribe("in_image_topic", 1, imageCallback);
ros::Publisher pub = nh.advertise<sensor_msgs::Image>("out_image_topic", 1);

Do:

// Use the image_transport classes instead.
#include <ros/ros.h>
#include <image_transport/image_transport.h>

void imageCallback(const sensor_msgs::ImageConstPtr& msg)
{
  // ...
}

ros::NodeHandle nh;
image_transport::ImageTransport it(nh);
image_transport::Subscriber sub = it.subscribe("in_image_base_topic", 1, imageCallback);
image_transport::Publisher pub = it.advertise("out_image_base_topic", 1);
image_transport publishers advertise individual ROS Topics for each availa

ble transport - unlike ROS Publishers, which advertise a single topic. The topic names follow a standard naming convention, outlined below. Note, however, that all code interfaces take only a “base topic” name (to which the transport type is automatically appended); typically you should not directly reference the transport-specific topic used by a particular plugin.

Python Usage
image_transport does not yet support Python, though it is on the Roadmap. If you need to interface a Python node with some compressed image transport, try interposing a republish node.

Known Transport Packages

If you have implemented a new transport option in a public repository and would like to see it added to this list, please email our mailing list.

ros-pkg
image_transport (“raw”) - The default transport, sending sensor_msgs/Image through ROS.

compressed_image_transport (“compressed”) - JPEG or PNG image compression.

theora_image_transport (“theora”) - Streaming video using the Theora codec.

Library ROS API

ROS Publishers and Subscribers are used to transport messages of any type. image_transport offers publishers and subscribers specialized for images. Because they encapsulate complicated communication behavior, image_transport publishers and subscribers have a public ROS API as well as a C++ code API. Please see the separate code API documentation for C++ usage. The ROS API is documented below.

image_transport Publishers
image_transport publishers are used much like ROS Publishers, but may offer a variety of specialized transport options (JPEG compression, streaming video, etc.). Different subscribers may request images from the same publisher using different transports.

C++: image_transport::Publisher (API), image_transport::CameraPublisher (API)

Published topics

image_transport publishers advertise individual ROS Topics for each available transport - unlike ROS Publishers, which advertise a single topic. The topic names follow a standard naming convention, outlined below. Note, however, that all code interfaces take only a “base topic” name; typically you should not directly reference the transport-specific topic used by a particular plugin.

The raw sensor_msgs/Image is published on the base topic, just as with using a normal roscpp ros::Publisher. If additional plugins are available, they advertise subtopics of the base topic, conventionally of the form /. For example, using plugins for “compressed” and “theora” transports, with a base topic of /stereo/left/image, the topics would be:

stereo/left/image (sensor_msgs/Image)

Base topic, used for “raw” transport. Advertised just as if we used ros::Publisher.
stereo/left/image/compressed ()
Topic for “compressed” transport.
stereo/left/image/theora ()
Topic for “theora” transport.
stereo/left/camera_info (sensor_msgs/CameraInfo)
(image_transport::CameraPublisher-only) Camera info topic.
Parameters
image_transport publishers have no independent parameters, but plugins are permitted to make use of the Parameter Server for configuration options, e.g. bit rate, compression level, etc. See the plugin package documentation.

Publisher plugin parameters give subscribers hooks to configure the publisher-side encoding to suit the needs on the client side. Lookup therefore occurs in the public namespace defined by <base_topic>, rather than the private namespace of the publishing node. Note that these parameters are a shared resource, controlling the behavior observed by all subscribers to the image topic.

Publisher plugin parameters should be exposed through dynamic_reconfigure for best visibility and ease of use. Conventionally, they take the following form:

Reconfigurable parameters

// (type, default: ?) Transport-specific publisher parameter. /camera/image/compressed/jpeg_quality (int, default: 80) An example transport-specific parameter which sets the JPEG quality for "compressed" transport for image topic /camera/image. image_transport Subscribers image_transport subscribers are used much like roscpp's ros::Subscriber, but may use a specialized transport to receive images.

C++: image_transport::Subscriber (API), image_transport::CameraSubscriber (API)

Subscribed topics
A Subscriber instance is created with a “base topic” name and the name of the transport to use. It subscribes to the transport-specific ROS topic associated with the base topic. For example, if the base topic is /stereo/left/image, the subscribed topics for transports “raw” and “compressed” are respectively:

stereo/left/image (sensor_msgs/Image)

Base topic, used for the default “raw” transport. Subscribed just as if we used ros::Subscriber.
stereo/left/image/compressed ()
Topic for “compressed” transport.
stereo/left/camera_info (sensor_msgs/CameraInfo)
(image_transport::CameraSubscriber-only) Camera info topic.

Parameters
~image_transport (string, default: “raw”)
Name of the transport to use.
If this parameter is not set, the transport from the image_transport::TransportHints argument of image_transport::ImageTransport::subscribe() is used.

image_transport::TransportHints may be used to specify a different namespace for parameter lookup. This is useful to remap ~image_transport into a separate namespace to allow different transports for different image subscriptions. The node writer may even specify a parameter name other than ~image_transport, although this is discouraged for the sake of consistency. Nodes that subscribe to image topics should document what parameter(s) control transport, especially if different from ~image_transport.

Subscriber plugins are permitted to make use of the Parameter Server for configuration options, e.g. video post-processing level. See the plugin package documentation.

Subscriber plugin parameters configure the behavior of one particular subscriber. They affect how the data received is interpreted (decoded). This differs from publisher plugin parameters, which are a shared resource affecting the data sent to all subscribers. The namespace used for parameter lookup is again specified through image_transport::TransportHints, defaulting to the private namespace of the subscribing node.

Subscriber plugin parameters should be exposed through dynamic_reconfigure for best visibility and ease of use. Conventionally, they take the following form:

Reconfigurable parameters
~/ (type, default: ?)
Transport-specific subscriber parameter.
~theora/post_processing_level (int, default: 0)
An example transport-specific parameter which sets the post-processing level when subscribed using “theora” transport.

Nodes

republish

republish listens on one base image topic (using any transport type, “raw” by default) and republishes the images to another base topic. By default it uses all available publishing plugins; you may optionally specify a single out transport type. “raw” is the name of the default transport, publishing sensor_msgs/Image messages. What other transports are available depends on which plugins are built.

Usage

$ republish [in_transport] in:=<in_base_topic> [out_transport] out:=<out_base_topic>
Examples
Suppose we are publishing images from a robot using the streaming video transport “theora”. On an offboard computer we have several nodes listening to the image topic. This setup wastes bandwidth and computation, as each node processes the compressed video into still images independently. Instead we can start a republish node on the offboard computer, streaming the video only to that node for processing into sensor_msgs/Image messages republished to the other nodes:

$ republish theora in:=camera/image raw out:=camera/image_decompressed
The above command is also useful simply to pipe a compressed image topic into a node that can only listen to sensor_msgs/Image (because it uses ros::Subscriber or is written in a language other than C++).

If a node publishes images only as sensor_msgs/Image, we can republish it using the full range of transports. Note however that the base topic must be different from the original topic, and this approach entails a slight overhead over using image_transport::Publisher in the original node.

$ republish raw in:=camera/image out:=camera/image_repub

Subscribed Topics

in ()
The image base topic to listen on (may actually subscribe to a subtopic).
Published Topics
out ()
The image base topic to publish to (may also publish subtopics).
Parameters
republish itself does not make use of the Parameter Server. Plugins may read or set plugin-specific parameters, however.

Command-line tools

list_transports
list_transports lists the declared image transport options across all ROS packages and attempts to determine whether they are currently available for use (packages built, plugins able to be loaded properly, etc.).

Usage

$ rosrun image_transport list_transports
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

菜鸡的ROS学习笔记(image_transport) 的相关文章

  • 解决vscode智能代码提示快捷键 Ctrl+Space 无效的问题

    背景 vscode 智能代码提示除了输入时通过字符触发 xff0c 还能使用快捷键ctrl 43 space触发 xff0c 但是在 Windows 下会发现没有效果 因为这个快捷键在Windows下是系统的中文 简体 输入法 输入法 非输
  • Ubuntu系统安装、并解决Ubuntu系统网络连接激活失败问题

    Ubuntu系统安装 并解决Ubuntu系统网络连接激活失败问题 前言 1 Ubuntu安装过程中要保证网络连接稳定 2 Ubuntu安装过程要保证U盘不离开插槽 3 第一次安装请先浏览整个过程 xff0c 再进行操作 4 卸载Ubuntu
  • 激光雷达运动畸变去除方法

    文章目录 一 激光雷达运动畸变产生的原因二 为什么需要解决这个问题 xff1f 三 去除运动畸变的原理四 运动去畸变的方法1 纯估计方法 xff08 ICP VICP xff09 2 传感器辅助的方法 xff08 odom xff0c IM
  • curl下载文件的命令

    curl文件下载 curl将下载文件输出到stdout xff0c 将进度信息输出到stderr xff0c 不显示进度信息使用 silent 选项 1 curl URL silent 这条命令是将下载文件输出到终端 xff0c 所有下载的
  • 倍福ADS通讯(一)——ADS通讯简介

    ADS通讯简介 xff08 一 xff09 简介 xff08 二 xff09 ADS通讯协议概述 xff08 三 xff09 ADS通讯协议的设备标识 xff08 四 xff09 使用TwinCAT Ads中间件 xff08 一 xff09
  • 使用select的TCP服务器

    select函数详解 span class token macro property span class token directive hash span span class token directive keyword inclu
  • undefined symbol问题的查找、定位与解决方法

    今天被客户测出来一个问题 xff1a 程序执行中报错 xff0c 报错内容如下 XXXX xff1a symbol lookup error xff1a home libpdfium so xff1a undefined symbol xf
  • PRD-审批流BPM(结合企微审批引擎和结合flowable方案选择)

    前言 流程设计历来都是比较繁琐之事 xff0c 由于公司急需上线流程化的平台 xff0c 内部系统迫切需要升级 xff0c 在无产品经理的情况下 xff0c 我迎难而上 xff0c 正如 人人都是产品经理 所言 不是每个人都能以产品经理为业
  • VS Code用久了后,启动速度变慢

    目录 前提发现过程解决方法方法一方法二方法三 前提 不是因为电脑性能或者插件装太多导致的 是在使用一段时间后 xff0c 逐渐变慢 看结论直接跳转到解决方法 发现过程 困扰了很久 xff0c 这次一鼓作气找出问题 xff0c 太激动了 xf
  • ROS基础——话题、服务、动作编程

    文章目录 工作空间功能包ROS通信编程1 话题编程2 服务编程3 动作编程 参考资料 工作空间 存放工程开发相关文件的文件夹 xff0c 其中主要包括src xff0c build xff0c devel xff0c install文件夹
  • 一、ROS的五个特点

    一 ROS的五个特点 xff1a 1 点对点设计 点对点的设计通俗的讲就是一个大的工程项目 xff0c 每个动能相互是独立的 xff0c 或者耦合比较低 有一个大脑负责总的任务调度 xff0c 为服务和客户建立连接充当媒介 各个功能之间可以
  • LINK1104 无法打开文件“libboost_atomic-vc142-mt-gd-x64-1_76.lib”

    问题描述 LNK1104 无法打开文件 libboost atomic vc142 mt gd x64 1 76 lib 可能原因 xff1a 相应的包没有安装 xff0c 可以再电脑上搜一下 xff0c 是否搜索到 xff0c 如果搜索到
  • 2021-08-10

    LEGO loam第一次测试运行数据包nsh indoor outdoor成功 xff1a 记录以下 xff0c 以免自己忘记步骤 在第一个终端里 xff1a 1 source catkin ws devel setup bash xff0
  • 趣味GPS

    简介 GPS的全称是全球定位系统 the Global Positioning System 它属于美国政府 xff0c 并由洛杉矶的联合项目办公室 JPO Joint Program Office 管理 1957年 xff0c 苏联发射第
  • 如何访问西门子S1500PLC的IO系统

    提示 xff1a 本文仅代表个人在项目中的使用看法 xff0c 不参与任何真理的辩驳 文章目录 前言一 硬件配置二 访问方式1 S1500与ET200MP1 ET200MP的组态2 ET200MP的IO调用 2 S1500与ET200AL1
  • CubeMX配合PlatformIO开发STM32(STorM32),配置双MPU6050(板载与外置),并使用gui显示数据

    本人使用的设备 驱动 xff1a Windows10串口助手 4 3 25 其实啥都行 桃饱随处可买的usb ttl xff08 ch340G xff09 桃饱随处可买的stlinkmpu6050 xff08 一个板载 xff0c 一个通过
  • ros学习心得(九)ros之Topic通讯机制及发送与接收节点的编码与调试

    节点间需要有数据交互 xff0c 而ros所要解决的问题就是数据该如何交互 一 通讯原理图 ros在设计Node间通讯机制的时候 xff0c 考虑的是很周全的 Publisher 发送消息的 xff0c Subscriber 接收消息的 T
  • 硬石开发板STM32F407IGT6 (HAL库)学习笔记

    硬石开发板STM32F407IGT6 xff08 HAL库 xff09 学习笔记 2020 06 21 2020 06 22 2020 06 23 2020 06 24 该笔记为学习时遇到的问题与解决方法等内容的记录 xff0c 可能有错
  • Ubuntu20/视觉SLAM十四讲踩坑记录

    Ubuntu 视觉SLAM十四讲踩坑记录 Ubuntu xff08 20 xff09 视觉SLAM十四讲踩坑记录 xff1a 共性问题 xff1a 1 安装OpenCV后 xff0c 例程仍无法找到OpenCV文件 ch3 visualiz
  • AMESim2020.1仿真编译失败解决方法之一

    AMESim2020 1仿真编译失败解决方法之一 问题描述 xff1a 软件安装正确 xff0c 在准备和matlab联合仿真时 xff0c 换用VC2015以上版本编译器编译失败 解决方法 xff1a 到AMESim安装路径下 xff0c

随机推荐

  • Linux/Ubuntu20.04下载安装Geant4及B1示例测试

    Linux Ubuntu20 04下载安装Geant4及B1示例测试 0 参考内容1 下载geant4软件包2 geant4安装准备内容3 geant4文件编译4 安装数据包4 1 安装方式14 2安装方式2 5 添加文件路径6 B1示例测
  • Ubuntu20.04进行CUDA11.0及对应CUDNN安装

    Ubuntu20 04进行CUDA11 0及对应CUDNN安装 xff1a 基本步骤 xff1a 1 安装nvidia显卡驱动 可直接通过 xff1a 软件和更新 gt 附加驱动 选择满足CUDA版本的nvidia专有驱动 gt 应用更改
  • git分离头指针处理

    文章目录 1 什么是git分离头指针2 将git 分离头指针所指向的代码 xff08 commit id xff09 保存下来总结 本文将主要介绍一下git分离头指针状态 xff0c 并记录如何将分离头指针状态的代码合并到分支中 1 什么是
  • Docker使用系列——Docker安装(Ubuntu20.04)

    Docker使用系列 Docker安装 xff08 Ubuntu20 04 xff09 卸载安装测试问题 直接按官方安装教程即可 xff1a Install Docker Engine on Ubuntu 卸载 安装过老版本的Docker则
  • Docker使用系列——生成一个Ubuntu20.04+Pyqt5的容器

    由于在自己的电脑中安装Pyqt5不成功 xff0c 原因是与其他环境中的qt版本不兼容 因此 xff0c 了解到了docker xff0c 这里记录一下在docker中安装pyqt5过程 1 安装Docker并从官方仓库拉取Ubuntu 2
  • C语言实现链表(链式存储结构)

    链表 xff08 链式存储结构 xff09 及创建 链表 xff0c 别名链式存储结构或单链表 xff0c 用于存储逻辑关系为 一对一 的数据 与顺序表不同 xff0c 链表不限制数据的物理存储状态 xff0c 换句话说 xff0c 使用链
  • cmake与make的区别及CMakeLists.txt文件编写

    一 cmake与make的区别 make工具是一个自动化编译工具 xff0c 它会根据Makefile中的规则进行批处理编译 当需要编译的文件较多时 xff0c 使用make工具会大大提高效率 但是 xff0c 当项目较大时 xff0c 编
  • 接口测试学习必看 - 实现简易接口测试

    前言 终于整理到了接口测试部分的内容 xff0c 接口测试可以说是软件测试入门到初级软件测试的一个必备进阶技巧 很多挂着 灰盒测试 的标识 xff0c 其实就是对接口测试的另外一层理解 何为 灰盒 xff0c 能够看到一部分本质的东西 xf
  • roscpp 底层通讯协议更改

    ROS为机器人开发者们提供了不同语言的编程接口 xff0c 其中C 43 43 接口叫做roscpp xff0c 用来创建topic service param xff0c 实现ROS的通信功能 roscpp is a C 43 43 im
  • c++学习心得:STL初学(基础篇)

    标准函数库 xff08 STL xff09 学习心得 基础篇 STL主要由两种组件构成 xff1a 一是容器 xff0c 包括vector list set map等类 xff1b 另一种组件是用以操作这些容器的所谓的泛型算法包括find
  • STM32 LoRa无线数传模块 PC通过串口传输数据到单片机

    STM32 PC通过串口助手无线传输数据到单片机 之前学习了STM32单片机 xff0c 使用正点原子的精英板 两个TTL 转LoRa 半双工无线数传模块 xff0c 通过PC机串口助手 xff0c 向32单片机传输数据 xff0c 接收数
  • 如何使用 datax 将 mysql 中的数据拉取到 hive ?

    需求 使用datax将mysql中的数据拉取到hive的ods层 步骤 首先在mysql中确定好需要拉取的表user extend xff0c 然后对应在hive中创建好空表 xff0c 等待拉取 这里对应创建的hive表格如下 CREAT
  • C语言实现TCP客户端、服务器

    服务器 include lt stdio h gt include lt sys socket h gt include lt netinet in h gt include lt arpa inet h gt include 34 str
  • 树莓派控制无人机实现定点降落(概述目录)

    最近在做一个无人机与车协同的项目 xff0c 无人机需要比较准确地落到车的平台上 xff0c 而且因为经费较少只能用树莓派 xff0c 我的思路以及在调试过程中遇到的问题 xff0c 将公布在我接下来的博文里 这里列个目录 xff1a 树莓
  • C语言字符串常用函数总结(持续更新)

    最近在重温C语言的一些基础知识 xff0c 感觉C语言字符串操作还是比较难的 xff0c 在学习的过程中总结了一些常用的字符串相关函数 xff0c 包括C语言字符串输入 字符串输入 计算字符串长度 字符串赋值 字符串分割 字符串拼接 字符串
  • git tag和branch的关系

    tag类似于从commit发展出来的一个可写的玩具分支 它和branch很像 xff0c 但是可以快速取消所有修改 更多是用于快照查看的 如果它基于的commit被ammend变化了 xff0c 他俩的commit id 就会不一样了 xf
  • git命令之分支管理和Tag标签

    x1f4dd 个人简介 个人主页 xff1a 我是段段 x1f64b x1f34a 博客领域 xff1a 编程基础 前端 x1f4bb x1f345 写作风格 xff1a 干货 xff01 干货 xff01 都是干货 xff01 x1f35
  • 4个方面轻松搞定进度条

    不管是在APP还是PC xff0c 不管是Loading页 xff0c 还是在音乐播放器中 xff0c 进度条的运用都非常广泛 xff0c 形式也多种多样 xff0c 让人眼花缭乱 做为一个交互设计新手 xff0c 项目中也经常碰到进度条设
  • Ubuntu18.04安装ROS初始化rosdep阶段报错的解决方案

    在运行rosdep update时出现 reading in sources list data from etc ros rosdep sources list d ERROR unable to process source https
  • 菜鸡的ROS学习笔记(image_transport)

    菜鸡的ROS学习笔记 xff08 image transport xff09 image transport 这一部分是搬运的ROS wiki中的介绍 xff0c 主要是image transport这个包的用法 xff0c 之后我会把它尽