talker.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # license removed for brevity
00003 import rospy
00004 from std_msgs.msg import String
00005 
00006 def talker():
00007     pub = rospy.Publisher('chatter', String, queue_size=10)
00008     rospy.init_node('talker', anonymous=True)
00009     rate = rospy.Rate(1) # 10hz
00010     while not rospy.is_shutdown():
00011         hello_str = "hello world %s" % rospy.get_time()
00012         rospy.loginfo(hello_str)
00013         pub.publish(hello_str)
00014         rate.sleep()
00015 
00016 if __name__ == '__main__':
00017     try:
00018         talker()
00019     except rospy.ROSInterruptException:
00020         pass


gapter
Author(s):
autogenerated on Thu Jun 6 2019 22:05:13