2 # -*- coding: iso-8859-15 -*-
10 from time import sleep
12 rospy.init_node('wifi_strength')
14 tfBuffer = tf2_ros.Buffer()
15 listener = tf2_ros.TransformListener(tfBuffer)
16 regex_lq = re.compile("Link Quality=(\d*)/(\d*)")
17 while not rospy.is_shutdown():
18 f = os.popen("export LANG=C; /sbin/iwconfig wlan0")
21 match_lq = regex_lq.match(line)
22 if match_lq is not None:
23 lq = float(match_lq.group(1)) / float(match_lq.group(2))
24 pos = tfBuffer.lookup_transform("map", 'base_link', rospy.Time(0), rospy.Duration(1.0))
25 print '{"x":%.2f, "y":%.2f, "link":%.2f},' % (pos.transform.translation.x, pos.transform.translation.y, lq)