import os
from lcm import _lcm
from lcm._lcm import LCM, LCMSubscription
class Event(object):
"""Data structure representing a single event in an LCM EventLog
"""
def __init__ (self, eventnum, timestamp, channel, data):
"""
Initializer
"""
self.eventnum = eventnum
"""Event number"""
self.timestamp = timestamp
"""Microseconds since 00:00:00 Jan 1, 1970 UTC marking the time at
which the message was originally received
"""
self.channel = channel
"""Channel on which message was received"""
self.data = data
"""Binary string containing raw message data"""
class EventLog(object):
"""EventLog is a class for reading and writing LCM log files in Python.
An EventLog opened for reading supports the iterator protocol, with each call
to next() returning the next L{Event<lcm.Event>} in the log.
@undocumented: __iter__
"""
def __init__ (self, path, mode = "r", overwrite = False):
"""
Initializer
@param path: Path to the logfile to open
@param mode: Open the log for reading ('r') or writing ('w')
@param overwrite: If mode is 'w', and the filename at path already
exists, then EventLog will truncate and overwrite the file if this
parameter is set to True. Otherwise, EventLog refuses to overwrite
existing files and raises a ValueError.
"""
if mode not in [ "r", "w" ]:
raise ValueError ("invalid event log mode")
if mode == "w" and os.path.exists(path) and not overwrite:
raise ValueError ("Refusing to overwrite existing log file "
"unless overwrite is set to True")
self.mode = mode
self.c_eventlog = _lcm.EventLog (path, mode)
self.f = None
def seek (self, filepos):
"""
Positions the internal file pointer at the next event that
starts at or is after byte offset filepos.
@param filepos: byte offset from start of log
@return: None
"""
return self.c_eventlog.seek (filepos)
def seek_to_timestamp (self, timestamp):
"""Seek (approximately) to a particular timestamp.
@param eventlog The log file object
@param ts Timestamp of the target event in the log file.
@return: None
"""
return self.c_eventlog.seek_to_timestamp (timestamp)
def size (self):
"""
@return: the total size of the log file, in bytes
@rtype: int
"""
return self.c_eventlog.size ()
def close (self):
"""
Closes the log file. After an EventLog is closed, it is essentially
useless
@return: None
"""
return self.c_eventlog.close ()
def write_event (self, utime, channel, data):
"""
Writes an event to the log file. Log file must be openeed in write
mode.
@param utime: Microseconds since 00:00:00 Jan 1, 1970 UTC
@param channel: Channel name corresponding to the event
@param data: data bytes
@return: None
"""
return self.c_eventlog.write_event (utime, channel, data)
def read_next_event (self):
"""
@return: the next L{Event<lcm.Event>} in the log file.
@rtype: L{Event<lcm.Event>}
"""
tup = self.c_eventlog.read_next_event ()
if not tup: return None
return Event (*tup)
def __iter__ (self):
self.c_eventlog.seek (0)
return self
def __next__ (self):
"""
Python 2.6 - 3.x version for iterators
@rtype: L{Event<lcm.Event>}
"""
return self.next()
def next (self):
"""
@rtype: L{Event<lcm.Event>}
"""
next_evt = self.read_next_event ()
if not next_evt:
raise StopIteration
return next_evt
def tell (self):
"""
@return: the current position of the internal file pointer, in bytes
@rtype: int
"""
return self.c_eventlog.ftell ()
没有合适的资源?快使用搜索试试~ 我知道了~
lcm 1.4.0 编译后的dll和exe windows平台 x86 x64 donet
共43个文件
exe:25个
dll:14个
pyd:2个
需积分: 50 20 下载量 152 浏览量
2020-03-14
15:26:27
上传
评论
收藏 3.16MB ZIP 举报
温馨提示
基于http://lcm-proj.github.io/的lcm 1.4.0版本软件编译的,编译环境是WIN7+VS2019,参考了https://blog.csdn.net/weixinhum/article/details/81354061的方法,release模式下编译了x86 x64和donet的相关工程,压缩包中每个文件都包含了exe及其依赖的dll,我在其它的win10和win7下试过,可以运行(需要安装vc_redist.x64或vc_redist.x86.exe)exe程序,python的生成文件也有但没试过,其它支持的语言(matlab,go,lua)我不懂所以也不清楚。xp没试过,不保证能跑。
资源推荐
资源详情
资源评论
收起资源包目录
lcm_binaryOutput.zip (43个子文件)
lcm_binaryOutput
x86
lcm.dll 68KB
libpcre-1.dll 279KB
lcm-gen.exe 196KB
Lib
site-packages
lcm
Release
_lcm.pyd 79KB
__init__.py 4KB
libiconv-2.dll 1.01MB
lcm-example.exe 10KB
libwinpthread-1.dll 62KB
lcm-buftest-sender.exe 9KB
libgcc_s_dw2-1.dll 119KB
lcm-buftest-receiver.exe 10KB
libglib-2.0-0.dll 1.26MB
lcm-logplayer.exe 13KB
lcm-logger.exe 23KB
libintl-8.dll 138KB
lcm-sink.exe 9KB
lcm-tester.exe 11KB
lcm-logfilter.exe 14KB
lcm-source.exe 11KB
x64
lcm.dll 79KB
libpcre-1.dll 281KB
lcm-gen.exe 222KB
Lib
site-packages
lcm
Release
_lcm.pyd 94KB
__init__.py 4KB
libiconv-2.dll 1.01MB
lcm-example.exe 12KB
libwinpthread-1.dll 57KB
lcm-buftest-sender.exe 11KB
lcm-buftest-receiver.exe 11KB
libglib-2.0-0.dll 1.12MB
lcm-logplayer.exe 14KB
lcm-logger.exe 25KB
libintl-8.dll 132KB
lcm-sink.exe 10KB
lcm-tester.exe 13KB
lcm-logfilter.exe 14KB
lcm-source.exe 13KB
donet
example_t_display.exe 8KB
lcm.dll 26KB
temperature_t_transmit.exe 6KB
temperature_t_display.exe 7KB
example_t_transmit.exe 8KB
tcp_provider_demo.exe 6KB
共 43 条
- 1
资源评论
xujinpeng1117
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功