5 from rtabmap_ros.msg
import UserData
8 rospy.init_node(
'wifi_signal_pub', anonymous=
True)
9 pub = rospy.Publisher(
'wifi_signal', UserData, queue_size=10)
10 rate = rospy.Rate(0.5)
11 while not rospy.is_shutdown():
13 myCmd = os.popen(
'nmcli dev wifi | grep "^*"').read()
14 cmdList = myCmd.split()
17 quality = float(cmdList[6])
22 rospy.loginfo(
"Network \"%s\": Quality=%d, %f dBm", cmdList[1], quality, dBm)
35 msg.data = struct.pack(b
'dd', dBm, rospy.get_time())
39 rospy.logerr(
"Cannot get info from wireless!")
42 if __name__ ==
'__main__':
45 except rospy.ROSInterruptException: