00001
00002 import roslib; roslib.load_manifest('actionlib_tutorials')
00003 import rospy
00004 from std_msgs.msg import Float32
00005 import random
00006 def gen_number():
00007 pub = rospy.Publisher('random_number', Float32)
00008 rospy.init_node('random_number_generator', log_level=roslib.msg.Log.INFO)
00009 rospy.loginfo("Generating random numbers")
00010
00011 while not rospy.is_shutdown():
00012 pub.publish(Float32(random.normalvariate(5, 1)))
00013 rospy.sleep(0.05)
00014
00015 if __name__ == '__main__':
00016 try:
00017 gen_number()
00018 except Exception, e:
00019 print "Done"
00020
00021
00022
00023