fix_surf_pkl_time.py
Go to the documentation of this file.
00001 import csv
00002 import roslib; roslib.load_manifest('hai_sandbox')
00003 from cv_bridge.cv_bridge import CvBridge, CvBridgeError
00004 import rospy
00005 import cv
00006 import sys
00007 
00008 import hrl_lib.rutils as ru
00009 import hrl_lib.tf_utils as tfu
00010 import tf.transformations as tr
00011 import tf
00012 import hrl_camera.ros_camera as cam
00013 from sensor_msgs.msg import CameraInfo
00014 import numpy as np
00015 import hai_sandbox.features as fea
00016 import os.path as pt
00017 import hrl_lib.util as ut
00018 import itertools as it
00019 
00020 #Load original pickle
00021 orig_bag = sys.argv[1]
00022 topic = '/l_forearm_cam/image_rect_color'
00023 
00024 #Load surf pickle
00025 print 'loading pickle', sys.argv[2]
00026 surf_pkl = ut.load_pickle(sys.argv[2])
00027 
00028 new_surf_data = []
00029 
00030 print 'replacing time field'
00031 for tmt, surf_record in it.izip(ru.bag_iter(orig_bag, [topic]), surf_pkl) :
00032     topic, msg, t = tmt
00033     surf_t, surf_data = surf_record 
00034     new_surf_data.append((msg.header.stamp.to_time(), surf_data))
00035 
00036 print 'saving pickle with new time', sys.argv[2]
00037 ut.save_pickle(new_surf_data, sys.argv[2])


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