5 from std_msgs.msg
import String, Float32
6 from threading
import Lock
20 g_format = config.format
24 global g_lock, g_msg, g_format
28 text_interface.publish(g_format.format(g_msg.data))
31 global g_lock, multi_topic_msgs, g_format
33 if all([msg
for topic, msg
in multi_topic_msgs.items()]):
34 text_interface.publish(g_format.format(sum([msg.data
for topic, msg
in multi_topic_msgs.items()])))
36 multi_topic_msgs = dict()
41 global multi_topic_msgs
42 multi_topic_msgs[self.
topic] =
None
44 global multi_topic_msgs
46 multi_topic_msgs[self.
topic] = msg
48 if __name__ ==
"__main__":
49 rospy.init_node(
"string_to_overlay_text")
51 multi_topics = rospy.get_param(
"~multi_topics", [])
52 g_format = rospy.get_param(
"~format",
"{0}")
55 for topic
in multi_topics:
57 subs.append(rospy.Subscriber(topic, String, callback.callback))
58 rospy.Timer(rospy.Duration(0.1), publish_text_multi)
60 sub = rospy.Subscriber(
"~input", String, callback)
61 rospy.Timer(rospy.Duration(0.1), publish_text)