00001 #!/usr/bin/env python 00002 import rospy 00003 from std_msgs.msg import String 00004 00005 00006 def talker(): 00007 pub = rospy.Publisher('chatter', String) 00008 rospy.init_node('talker') 00009 while not rospy.is_shutdown(): 00010 str = "Hello World %s" % rospy.get_time() 00011 rospy.loginfo(str) 00012 pub.publish(String(str)) 00013 rospy.sleep(1.0) 00014 00015 00016 if __name__ == '__main__': 00017 try: 00018 talker() 00019 except rospy.ROSInterruptException: 00020 pass