通信lcm

概念:

Lightweight Communications and Marshalling (LCM) ,轻量级别通信和编组
官方定义:
LCM is a set of libraries and tools for message passing and data marshalling, targeted at real-time systems where high-bandwidth and low latency are critical. It provides a publish/subscribe message passing model and automatic marshalling/unmarshalling code generation with bindings for applications in a variety of programming languages.
lcm 是一系列的库和工具,用来做数据的消息的传送和编组。针对高带宽和低延迟至关重要的实时系统。它为各种编程语言的应用程序提供了发布/订阅消息传递模型和自动编组/解编代码生成以及绑定。

特点:

Low-latency inter-process communication
Efficient broadcast mechanism using UDP Multicast
Type-safe message marshalling
User-friendly logging and playback
No centralized "database" or "hub" – peers communicate directly
No daemons
Few dependencies

a) 低延时, 进程间通信
b) 基于udp多播的高效广播机制
c) 类型安全消息编组
d) 用户友好的日志和回放机制
e) 没有中心的 database 或者 hub, 平级直接通信
f)没有守护程序
g)很少的依赖

通信原理:

The communications aspect of LCM can be summarizedas a publish-subscribe messaging system that uses UDPmulticast as its underlying transport layer. Under the publish-subscribe model, each message is transmitted on a named channel, and modules subscribe to the channels required to complete their designated tasks. It is typically the case(though not enforced by LCM) that all the messages on a particular channel are of a single pre-specified type.
lcm 通信方面可以被总结成发布-订阅消息系统。这个系统使用UDP多播作为一种底层通信层。在发布订阅这个模型的下面,每一个消息在一个命名的通道上传输,并且模块订阅要求完善指定的任务。通常情况下(尽管不是由LCM强制执行),特定通道上的所有消息都是单个预先指定的类型

  1. UDP Multicast:In typical publish-subscribe systems,a mediator process is used to maintain a central registry ofall publishers, channels, and subscribers. Messages are theneither routed through the mediator directly, or the mediatoris used to broker point-to-point connections between a pub-lisher and each of its subscribers. In both cases, the numberof times a message is actually transmitted scales linearly with
    the number of subscribers. When a message has multiplesubscribers, this overhead can become substantial
    UDP协议多播:典型发布-订阅系统中,中介进程用于维护所有发布者、频道和订阅者的中心注册表。然后消息要么直接通过中介路由,要么使用中介代理发布者与其每个订阅者之间的点对点连接。在这两种情况下,消息实际传输的次数与订户的数量成线性关系。当一条消息有多个订户时,这种开销会变得很大
    The approach taken by LCM, in contrast, is simply tobroadcast all messages to all clients. A client discards thosemessages to which it is not subscribed. Communicationnetworks such as Ethernet and the 802.11 wireless standardsmake this an efficient operation, where transmitted packetsare received by all devices regardless of destination.

相比之下,LCM采取的方法只是将所有消息广播给所有客户机。客户机丢弃未订阅的消息。诸如以太网和802.11无线标准之类的通信网络使这成为一种高效的操作,在这种操作中,无论目的地如何,所有设备都会接收传输的数据包。
LCM bases its communications directly on UDP multicast,which provides a standardized way to leverage this feature.Consequently, it does not require a centralized hub for eitherrelaying messages or for “match making”. A maximum LCMmessage size of 4 GB is achieved via a simple fragmentationand reassembly protocol. The multicast time-to-live param-eter is used to control the scope of a network, and is mostcommonly set to 0 (all software modules hosted on the samecomputational device) or 1 (modules spread across deviceson the same physical network).
lcm 基于udp多播的中通信方式,这提供了一种标准化的方法来利用这一点特征。因此,它不需要一个集中式集线器来转发消息或进行“匹配”。通过一个简单的碎片和重组协议,可以实现4 GB的最大LCM消息大小。多播生存时间参数用于控制网络的范围,通常设置为0(同一计算设备上托管的所有软件模块)或1(同一物理网络上跨设备分布的模块)。
2) Delivery Semantics:LCM provides a best-effort packetdelivery mechanism and gives strong preference to the expe-dient delivery of recent messages, with the notion that the ad-ditional latency and complexity introduced by retransmissionof lost packets does not justify delaying newly transmittedmessages.In general, a system that has significant real-time con-straints, such as a robot, may often prefer that a lost packet(e.g., a wheel encoder reading) simply be dropped rather thandelay future messages. LCM reflects this in its default modeof operation; higher level semantics may still be implementedon top of the LCM message passing service.
2) 交货语义:LCM提供一种尽力而为的数据包传递机制,它强烈倾向于最近消息的快速传递,因为丢失数据包的重传所带来的额外延迟和复杂性不能证明延迟是合理的发送的消息一般来说,一个系统重要的实时限制,例如机器人,可能通常倾向于丢弃丢失的数据包(例如,车轮编码器读取),而不是延迟将来的消息。LCM在其默认的操作模式中反映了这一点;更高级别的语义仍然可以在LCM消息传递服务的顶部实现。

性能

IPC的性能分析,主要在带宽,延迟,丢包情况这几点来评估。
One way to measure the interprocess communication per-formance of LCM is by examining its bandwidth, latency,and message loss under various conditions. Figs. 4 and 5show a comparison of the C and Java implementations ofLCM with IPC and the ROS TCP transport

衡量LCM进程间通信性能的一种方法是在各种条件下检查其【带宽】、【延迟】和【消息丢失】。figer 4和figer 5展示了使用IPC,ROS TCP,LCM的C和Java实现的比较。详细表格请查看源文档。
a source node transmits fixed-size message sat various rates

测试方法:

源节点以各种速率传输固定大小的数据。1,2,4个客户端节点订阅这个消息。收到消息后立即回显。源节点测量(1)成功回显的消息数。(2)每个往返消息的回显时间。(3)原始传输和回拨消耗的带宽。
IPC: 两种方式,a, 中央处理器做消息转发. b, 中央处理器只做匹配,消息之间的传递是peer to peer。(central -c)为了提高表现,操作系统的发送和接收的buffer提高到2M。
ROS: ROS测试的实现是通过ROS Box Turtle,with TCP_nodelay, 两种不同的最大队列长度来权衡消息丢失和延迟。
To collect each data point, the sender transmits 100MB of data split into 800 byte messages at a fixed rate determined by a target transmission bandwidth
为了收集每个数据点,发送方以目标传输带宽确定的固定速率传输100MB的数据,这些数据被分成800字节的消息
配置:8核工作站 和 通过 1000Base-T 以太网连接,产生了同样的效果。在一些情况下,由于传输和软件的限制,实际的速率和目标速率不一致。

结果分析:

lcm的规模于数据的发送量(amount of traffic)和订阅数sub-scribers存在关系。
从这些数字中,我们可以看到LCM是随着要发送的通信量和子抄写器的数量而扩展的。当达到网络容量时,LCM将延迟降至最低,并通过丢弃数据来保持高带宽消息。消息LCM Java实现的性能与C实现相当,并通过丢弃更多消息来响应虚拟机的计算限制
IPC: IPC在一个订阅者中表现良好,但由于传输每个消息的多个副本,无法很好地扩展到多个订阅者。2使用IPC(central-c)的match makingservice(中央-c)可提高带宽和减少延迟,但最终还是一样的困难。我们注意,尽管具有对等连接的IPC随着尝试的传输速率的增加而保持较低的延迟,但实际实现的带宽不会因为重复消息的链路饱和而增加。例如,在四个客户机回显消息的情况下,IPC的传输速度不能超过11mb/s,因为四重传输所消耗的带宽和回显使链路容量饱和。
ROS:
当最大队列长度(q)设置为无穷大时,ROS-TCP传输实现了高吞吐量,但代价是消息延迟。QP的各种设置在吞吐量和延迟之间提供了可调整的折衷。当Q=100时,消息延迟与较高数据速率下的LCM相当,但由于缓冲区已满,消息丢失更为频繁。

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值