00001 import rospy 00002 from sensor_msgs.msg import Range 00003 00004 rospy.init_node('sender') 00005 r = Range() 00006 00007 r.header.frame_id = '/base_laser_link' 00008 r.field_of_view = 25*3.14/180 00009 r.max_range = 100 00010 r.range = 1 00011 00012 pub = rospy.Publisher('/sonar', Range) 00013 00014 while not rospy.is_shutdown(): 00015 r.header.stamp = rospy.Time.now() 00016 pub.publish(r) 00017 00018 rospy.sleep(5)