脚本:截取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 ...
 
随机推荐
- 【vue】路由配置
			
一般组件我们会有全屏组件,或是在页面的某个部分显示组件,所以路由的第一层一般是全屏显示的,而在/目录下的组件为页面的某个部分显示的,通常需求是这样的,登录是全屏显示的,而普通页面是在页面的某个部分进行 ...
 - 集合-Collections工具
			
1.定义 Collections是集合类的一个工具类,它提供了一系列静态方法用于对容器中的元素进行排序和搜索等一系列操作. 注:Collection是一个集合接口,而Collections是一个有着操 ...
 - error: no matching function for call to 'std::exception:exception(const char[16])'
			
环境:codeblocks 语言:C++ 在执行:throw new exception("queue is empty.");时 遇到问题:error: no matching ...
 - spring事务源码分析结合mybatis源码(一)
			
最近想提升,苦逼程序猿,想了想还是拿最熟悉,之前也一直想看但没看的spring源码来看吧,正好最近在弄事务这部分的东西,就看了下,同时写下随笔记录下,以备后查. spring tx源码分析 这里只分析 ...
 - Docker入门-docker-compose使用(二)
			
Docker Docker容器大行其道,直接通过 docker pull + 启动参数的方式运行比较麻烦, 可以通过docker-compose插件快速创建容器 1.安装docker-compose ...
 - Hack Programming
			
计算机由ROM(instruction memory).RAM(data memory).CPU组成,其关系如下图 在计算中存在3种寄存器:D.A.M.其中D是data register,A是addr ...
 - 【原创】大数据基础之Oozie vs Azkaban
			
概括 Azkaban是一个非常轻量的开源调度框架,适合二次开发,但是无法直接用于生产环境,存在致命缺陷(比如AzkabanWebServer是单点,1年多时间没有修复),在一些情景下的行为简单粗暴(比 ...
 - Canvas  画占比图 解决canvas锯齿 bug
			
案例如图: <section class=" chartWrap"> <div class="chartContent"> <di ...
 - 烽火R2600交换机配置脚本
			
烽火交换机端口映射配置 ip nat inside source static udp iP 端口号 公网iP 端口号 ip nat inside source interface Vlan-intf ...
 - [DIV+CSS] set the screen capture Part 1 (div截取屏幕)
			
使用下面的代码来获取屏幕.用DIV加CSS 来控制. 使用mousemove来获取移动的时候DIV的变化, 效果图如下: 使用5个DIV来组成实现截图目的第一部分,现在只是实现了选择的第一部分. HT ...