脚本:截取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 ...
随机推荐
- Kaldi nnet3的fastlstm与标准LSTM
标准LSTM: 与标准LSTM相比,Kaldi的fastlstm对相同或类似的矩阵运算进行了合并. # Component specific to 'projected ...
- 208道面试题(JVM部分暂无答案)
这是从网上看到的一套java面试题, 答案只是一个大概, 另外题目质量参差不齐, 斟酌参考(JVM的部分暂时没有答案) 一.Java 基础 JDK 和 JRE 有什么区别? 答: JDK(Java D ...
- [Kubernetes]如何让集群为我们工作?
前一段时间倒腾k8s的时候,写了一系列的博客,有很多人不理解那样做的意义是什么,为什么要那样做,这篇文章就尝试解释一下,在实际环境中,是如何让集群为我们工作的. 因为只研究了一个月左右的时间,认识难免 ...
- Centos7中一键安装zabbix
作者:邓聪聪 #!/bin/shlog=/root/install.logexec 2>>$log #关闭SELINUX,防火墙 systemctl stop firewalld.serv ...
- BETA 版冲刺前准备(团队)
过去存在的问题 文档问题 未能事先做好设计文档,且小程序与后端数据库接口存在问题 界面问题 原型图设计花的时间较少,小程序设计界面仍相对粗糙,前端成员css元素应用经验不足 小程序界面之间对接存在问题 ...
- JsRender练习总结
1.假设的数据,基础部分. <div id="list1"></div> <script type="text/tmp" id=& ...
- CentOS6配置Taiga
背景 企业项目管理是一个比较复杂的事情,这个市场需求非常大,目前市面上也存在着teambition,tower等平台,但是这些工具平台目前都是付费才能有完整的功能,免费版根本不能满足团队的需求.一番调 ...
- spring boot 添加拦截器的简单实例(springBoot 2.x版本,添加拦截器,静态资源不可访问解决方法)
spring中拦截器主要分两种,一个是HandlerInterceptor,一个是MethodInterceptor 一.HandlerInterceptor HandlerInterceptor是s ...
- numpy创建array【老鱼学numpy】
在上一篇文章中,我们已经看到了如何通过numpy创建numpy中的数组,这里再重复一下: import numpy as np # 数组 a = [[1, 2, 3], [4, 5, 6]] prin ...
- MyCat-简介
一MyCat简介 java编写的数据库中间件 Mycat运行环境需要JDK. Mycat是中间件.运行在代码应用和MySQL数据库之间的应用. 前身 : corba. 是阿里开发的数据库中间件.实现M ...