bagread_test.py
Go to the documentation of this file.
00001 import roslib; roslib.load_manifest('hai_sandbox')
00002 import rospy
00003 import rosrecord
00004 import sys
00005 
00006 f = open(sys.argv[1])
00007 i = 0
00008 for topic, message, time in rosrecord.logplayer(f):
00009     i = i + 1
00010     print topic, time
00011     if i > 10:
00012         break
00013 f.close()
00014 
00015 ##
00016 # In this bag, give me messages from these topics
00017 # @param file_name
00018 # @param topics
00019 def bag_reader(file_name, topics):
00020     f = open(file_name)
00021     tdict = {}
00022     for t in topics:
00023         tdict[t] = True
00024     for r in rosrecord.logplayer(f):
00025         if tdict.has_key(r[0]):
00026             yield r
00027     f.close()
00028 


hai_sandbox
Author(s): Hai Nguyen
autogenerated on Wed Nov 27 2013 11:46:56