Go to the documentation of this file.00001
00002 import roslib; roslib.load_manifest('cob_relayboard')
00003 import rospy
00004 import time
00005 import csv
00006 from cob_relayboard.msg import EmergencyStopState
00007 from std_msgs.msg import Float64
00008
00009
00010
00011
00012 def callback(data):
00013 writer.writerow( ( round((rospy.Time.now() - starttime).to_sec(),5), data.data) )
00014
00015
00016
00017
00018 def record():
00019 rospy.init_node('record_voltage')
00020 global starttime
00021 starttime = rospy.Time.now()
00022
00023 global f
00024 global writer
00025 filename = rospy.get_param("/recording_filename")
00026 f = open(filename, 'wt', 1)
00027 writer = csv.writer(f)
00028
00029 rospy.Subscriber("/power_board/voltage", Float64, callback)
00030
00031
00032 while not rospy.is_shutdown():
00033
00034
00035 rospy.sleep(1.0)
00036
00037 if __name__ == '__main__':
00038 record()
00039