00001 #!/usr/bin/env python 00002 00003 import roslib 00004 import rospy 00005 from std_msgs.msg import Float64 00006 from random import random 00007 def main(): 00008 rospy.init_node("random_float") 00009 pub = rospy.Publisher("/random_float", Float64) 00010 while not rospy.is_shutdown(): 00011 val = random() * 1.0 00012 pub.publish(Float64(val)) 00013 rospy.sleep(0.1) 00014 00015 00016 if __name__ == "__main__": 00017 main()