$search
00001 #!/usr/bin/python 00002 00003 # print out Nao odometry data to screen and file "odom.txt" 00004 # e.g. for quick Gnuplot plotting 00005 00006 import roslib 00007 roslib.load_manifest('nao_remote') 00008 import rospy 00009 00010 from nao_msgs.msg import TorsoOdometry 00011 from nav_msgs.msg import Odometry 00012 00013 def handleTorsoOdom(data): 00014 00015 print("%f %f %f %f %f %f" % (data.x, data.y,data.z, data.wx,data.wy, data.wz)) 00016 global file 00017 file.write("%f %f %f %f %f %f\n" % (data.x, data.y,data.z, data.wx,data.wy, data.wz)) 00018 00019 00020 00021 if __name__ == '__main__': 00022 00023 rospy.init_node('torso2odom') 00024 odomPub = rospy.Publisher("odometry", Odometry) 00025 rospy.Subscriber("torso_odometry", TorsoOdometry, handleTorsoOdom) 00026 00027 file = open('odom.txt', 'w') 00028 00029 rospy.spin() 00030