Go to the documentation of this file.00001
00002 import time
00003 import roslib
00004 roslib.load_manifest('hrl_rfid')
00005 roslib.load_manifest('sound_play')
00006
00007 import rospy
00008 import time
00009 import numpy as np, math
00010 import hrl_rfid.ros_M5e_client as rmc
00011 import sound_play.libsoundplay as lsp
00012
00013 r = rmc.ROS_M5e_Client('ears')
00014 r.query_mode()
00015
00016 speaker = lsp.SoundClient()
00017
00018 i = 0
00019 reads_dict = {}
00020
00021 while not rospy.is_shutdown():
00022 if i % 2 == 0:
00023 read = r.read('EleLeftEar')
00024 else:
00025 read = r.read('EleRightEar')
00026 i = i + 1
00027
00028 print 'read:', read
00029
00030 if read[-1] > 92:
00031 if not reads_dict.has_key( read[-2] ):
00032 reads_dict[ read[-2] ] = time.time() - 3.5
00033
00034 if time.time() - reads_dict[ read[-2] ] > 3.0:
00035 reads_dict[ read[-2] ] = time.time()
00036 print read
00037 speaker.say( read[-2] )
00038
00039 r.stop()
00040
00041
00042