Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import rospy
00019 from cob_phidgets.msg import *
00020
00021 def callback(data):
00022
00023
00024 writer.writerow( ( round((rospy.Time.now() - starttime).to_sec(),5), data.value[1], data.value[0]) )
00025
00026 def record():
00027 rospy.init_node('record_current_and_voltage')
00028 global starttime
00029 starttime = rospy.Time.now()
00030
00031 global f
00032 global writer
00033 filename = rospy.get_param("~filename")
00034 global port_voltage, port_current
00035 port_voltage = rospy.get_param("~port_voltage")
00036 port_current = rospy.get_param("~port_current")
00037 f = open(filename, 'wt', 1)
00038 writer = csv.writer(f)
00039 writer.writerow(("time_from_start", "voltage", "current"))
00040
00041 rospy.Subscriber("/analog_sensors", AnalogSensor, callback)
00042
00043 rospy.spin()
00044
00045 if __name__ == '__main__':
00046 record()
00047