def publish_str(word): rospy.loginfo("Pub --> {}".format(word)) st = String() st.data = word[::-1] str_pub.publish(st)