脚本:截取euroc数据集bag文件的其中一段
脚本:截取euroc数据集bag文件的其中一段
功能:截取euroc数据集bag中的一段供算法测试
python脚本
#!/usr/bin/env python # ------------------------------------------------------------------------------
# Function : restamp ros bagfile (using header timestamps)
# Project : IJRR MAV Datasets
# Author : www.asl.ethz.ch
# Version : V01 21JAN2016 Initial version.
# Comment :
# Status : under review
#
# Usage : python restamp_bag.py -i inbag.bag -o outbag.bag
# ------------------------------------------------------------------------------ import roslib
import rosbag
import rospy
import sys
import getopt
from std_msgs.msg import String
from std_msgs.msg import Time def main(argv): inputfile = ''
outputfile = '' # parse arguments
try:
opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="])
except getopt.GetoptError:
print 'usage: restamp_bag.py -i <inputfile> -o <outputfile>'
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print 'usage: python restamp_bag.py -i <inputfile> -o <outputfile>'
sys.exit()
elif opt in ("-i", "--ifile"):
inputfile = arg
elif opt in ("-o", "--ofile"):
outputfile = arg # print console header
print ""
print "restamp_bag"
print ""
print 'input file: ', inputfile
print 'output file: ', outputfile
print ""
print "starting restamping (may take a while)"
print "" outbag = rosbag.Bag(outputfile, 'w')
messageCounter = 0
kPrintDotReductionFactor = 1000 try:
for topic, msg, t in rosbag.Bag(inputfile).read_messages():
stamp = float(str(msg.header.stamp)) / 1000000000
print stamp
if (stamp < 1403636700.827958):
outbag.write(topic, msg, msg.header.stamp) # Write message in output bag with input message header stamp
#outbag.write(topic, msg, msg.header.stamp) #if (messageCounter % kPrintDotReductionFactor) == 0:
#print '.',
# sys.stdout.write('.')
# sys.stdout.flush()
#messageCounter = messageCounter + 1 # print console footer
finally:
print ""
print ""
print "finished iterating through input bag"
print "output bag written"
print ""
outbag.close() if __name__ == "__main__":
main(sys.argv[1:])
脚本:截取euroc数据集bag文件的其中一段的更多相关文章
- 写个批处理脚本来帮忙干活--遍历文件夹&字符串处理
这次打算写几篇关于脚本方面的博客,主要是记录一下 Gradle 脚本和批处理脚本的一些写法,方便后续查阅. 前言 平常开发过程中,一些较为重复的手工性工作,如果能让脚本来帮忙处理,自然是最好的,刚好之 ...
- 【ros】.bag文件
Bags are typically created by a tool like rosbag They store the serialized message data in a file as ...
- linux bash脚本把A和B文件中有相同ID的B文件的内容输出到文件C
bash脚本把A和B文件中有相同ID的B文件的内容输出到文件C. Aid文件:ID001.1ID032.1ID090.10 Bfilt文件:XX XX XXX ID001.1 XXX999999999 ...
- Matlab 读取 ROS bag 文件指定消息数据
近期在接触Ros的时候遇到了一些问题,如何将rosbag中的信息提取出来进行进一步处理呢? 如三维点位置信息,视频信息(如果有的话)等等. 我采用的是MATLAB 读取bag信息 filepath=f ...
- 利用ROS工具从bag文件中提取图片
bag文件是ROS常用的数据存储格式,因此要从bag文件中提取数据就需要了解一点ROS的背景知识. 1. 什么是ROS及其优势 ROS全称Robot Operating System,是BSD-lic ...
- shell脚本 批量转换目录下文件编码
发布:JB01 来源:脚本学堂 [大 中 小] 分享一例shell脚本,实现可以批量转换目录下的文件编码,很实用的一个小shell,有需要的朋友参考下.原文地址:http://www.jb ...
- 从ROS bag文件中提取图像
从ROS bag文件中提取图像 创建launch文件,如下: export.launch <launch> <node pkg="rosbag" type=&qu ...
- loadrunner脚本中写入脚本输出log到外部文件,分析参数取值方式
loadrunner脚本中写入脚本输出log到外部文件,分析参数取值方式 分类: 心得 loadrunner 我的测试 2012-04-01 12:52 2340人阅读 评论(0) 收藏 举报 脚本l ...
- Shell脚本调用ftp上传文件
Shell脚本调用ftp上传文件 1.脚本如下 ftp -n<<! open x.x.x.x ###x.x.x.x为ftp地址 user username password ###user ...
随机推荐
- 设计模式七: 策略(Strategy)
简介 策略属于行为型模式的一种,策略模式允许对象的行为或算法在运行时改变,使用不同的算法达成相同的结果或目的. 实现层面上,定义一个抽象的算法接口, 然后根据具体算法的不同定义不同的类去实现该接口, ...
- 微信小程序【获取验证码】倒计时效果
最近开始接触微信小程序,会记录一些相关的小功能——例如这次是点击[获取验证码]按钮出现的倒计时效果. 原文: http://blog.csdn.net/Wu_shuxuan/article/detai ...
- Web从入门到放弃<8>
Ref: Cameron D. - HTML5, JavaScript and jQuery (Programmer to Programmer) - 2015 http://www.runoob.c ...
- 第二周 数据分析之展示 Matplotlib库入门
Matplotlib库介绍:优秀的数据可视化第三方库 使用:Matplotlib库由各种可视化类构成,内部结构复杂,受Matlab启发,matplotlib.pyplot是绘制各类可视化图形的命令子库 ...
- how2heap学习笔记
github源代码地址 这里只分析glibc2.25堆分配的特性,为了方便调试编译时使用 gcc -g -no-pie <input_file_name> -o <output_fi ...
- 【原创】大叔经验分享(9)yarn重要配置yarn.nodemanager.local-dirs
yarn中有一个比较重要的配置yarn.nodemanager.local-dirs,如果配置的不好,在饱和状态运行下集群会出现很多问题:1 默认配置${hadoop.tmp.dir}/nm-loca ...
- Solr坏境搭建
1.1. 搭建步骤 第一步:把solr 的压缩包上传到Linux系统 第二步:解压solr. 第三步:安装Tomcat,解压缩即可. 第四步:把dist目录下的solr.war部署到Tomcat下. ...
- HttpClient当HTTP连接的时候出现大量CLOSE_WAIT连接(转)
ESTABLISHED 表示正在进行网络连接的数量 TIME_WAIT 表示表示等待系统主动关闭网络连接的数量 CLOSE_WAIT 表示被动等待程序关闭的网络连接数量 上篇文章给出了解决TIME_W ...
- js编码解码 punyCode
;(function(w) { var PunycodeModule = function () { function IdnMapping() { this.utf16 = { decode: fu ...
- mysql字段有中英文,数字按照升序/降序 排序
ORDER BY CONVERT(name,SIGNED) ASC, CONVERT(name USING gbk) DESC