fix_gravity.py
Go to the documentation of this file.
00001 #! /usr/bin/python
00002 
00003 import sys
00004 import numpy as np
00005 import scipy.io
00006 
00007 import roslib
00008 roslib.load_manifest('hrl_phri_2011')
00009 import rospy
00010 
00011 import rosbag
00012 
00013 def main():
00014     bag = rosbag.Bag(sys.argv[1], 'r')
00015     prefix = ".".join(sys.argv[1].split(".")[:-1])
00016     fixed_file = prefix + "_fixed.bag"
00017     fixed_bag = rosbag.Bag(fixed_file, 'w')
00018     for topic, tf_msg, t in bag.read_messages():
00019         if topic == "/tf":
00020             if len(tf_msg.transforms) > 0 and tf_msg.transforms[0].child_frame_id == "/tool_netft_raw_frame":
00021                 tf_msg.transforms[0].transform.rotation.x = 0
00022                 tf_msg.transforms[0].transform.rotation.y = 0
00023                 tf_msg.transforms[0].transform.rotation.z = 1
00024                 tf_msg.transforms[0].transform.rotation.w = 0
00025         fixed_bag.write(topic, tf_msg, t)
00026     bag.close()
00027     fixed_bag.close()
00028     print "Saved fixed bag to:", fixed_file
00029 
00030 
00031 if __name__ == "__main__":
00032     main()


hrl_phri_2011
Author(s): Kelsey Hawkins
autogenerated on Wed Nov 27 2013 12:22:39