def publisher(): rospy.init_node('string_publisher') pub = rospy.Publisher('string_in', std_msgs.msg.String) m = std_msgs.msg.String(rospy.get_name()) r = rospy.Rate(10) while not rospy.is_shutdown(): pub.publish(m) r.sleep()
def publisher(): rospy.init_node('testheader_publisher') pub = rospy.Publisher('test_header_in', rosjava_test_msgs.msg.TestHeader) r = rospy.Rate(10) m = rosjava_test_msgs.msg.TestHeader() m.caller_id = rospy.get_name() m.header.stamp = rospy.get_rostime() while not rospy.is_shutdown(): pub.publish(m) r.sleep()