Skip to content

Commit 2a11095

Browse files
committed
fix #35 fix #40 fix #65
1 parent 1c43b79 commit 2a11095

File tree

12 files changed

+437
-392
lines changed

12 files changed

+437
-392
lines changed

event.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import threading
33
import rospy
44
import std_msgs
5+
import json
56

67
class EventManager:
78
_instance = None
@@ -18,12 +19,12 @@ def __init__(self, node_name):
1819
self._event_generators = []
1920
self._event_listeners = []
2021

21-
def get_publisher(self, topic):
22+
def publish(self, topic, message):
2223
publisher = self._publishers.get(topic)
2324
if publisher is None:
2425
publisher = rospy.Publisher("/" + self._node_name + "/" + topic, std_msgs.msg.String, queue_size=10)
2526
self._publishers[topic] = publisher
26-
return publisher
27+
publisher.publish(json.dumps(message))
2728

2829
def register_event_listener(self, topic, callback):
2930
self._event_listeners.append(rospy.Subscriber("/" + self._node_name + "/" + topic, std_msgs.msg.String, callback))

0 commit comments

Comments
 (0)