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
00019 import rospy
00020 from wifi_scan.msg import Fingerprint
00021 from std_msgs.msg import Header
00022
00023 def fingerprintCallback(fingerprint, f):
00024 rospy.loginfo(rospy.get_name() + ": I heard something")
00025 f.write(str(fingerprint.header.stamp) + ',')
00026 for address_rssi in fingerprint.list:
00027 values = address_rssi.address
00028 values += ','
00029 values += str(address_rssi.rssi)
00030 values +=','
00031 f.write(values)
00032 f.write('\n')
00033
00034 def groundTruthCallback(data, f):
00035 rospy.loginfo(rospy.get_name() + ": I heard something")
00036 f.write(str(data.stamp) + ',' + data.frame_id)
00037 f.write('\n')
00038
00039 def data_dump():
00040 rospy.init_node('data_dump')
00041 f = open('dump.csv', 'w')
00042 f.write('')
00043 f.close()
00044 f = open('dump.csv', 'a')
00045 rospy.Subscriber("/wifi_fp", Fingerprint, fingerprintCallback, f)
00046 rospy.Subscriber("/gt_nfc", Header, groundTruthCallback, f)
00047 rospy.spin()
00048
00049 if __name__ == '__main__':
00050 data_dump()