From 8d9948592c4bba60edae1cf7f0c7aabc2016b3ab Mon Sep 17 00:00:00 2001 From: Raphael Chang Date: Sat, 6 Feb 2016 16:44:45 -0500 Subject: [PATCH] Changed trusted name formatting --- launch/bar.launch | 9 +++++++++ launch/example.launch | 15 ++++++--------- launch/foo.launch | 19 +++++++++++++++++++ launch/server.launch | 8 ++++++++ src/client/client_node.py | 2 +- src/server/ws.py | 9 ++++----- 6 files changed, 47 insertions(+), 15 deletions(-) create mode 100644 launch/bar.launch create mode 100644 launch/foo.launch create mode 100644 launch/server.launch diff --git a/launch/bar.launch b/launch/bar.launch new file mode 100644 index 0000000..1773872 --- /dev/null +++ b/launch/bar.launch @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/launch/example.launch b/launch/example.launch index f86233f..4f9999c 100644 --- a/launch/example.launch +++ b/launch/example.launch @@ -9,14 +9,6 @@ - - publishing: - - /state - types: - - geometry_msgs/Point - trusted: - - /bar /baz - @@ -38,14 +30,19 @@ publishing: - /state + - /filtered_state types: - geometry_msgs/Point + - geometry_msgs/Point trusted: - - /foo + - foo bar baz + - foo bar + diff --git a/launch/foo.launch b/launch/foo.launch new file mode 100644 index 0000000..e2e6a47 --- /dev/null +++ b/launch/foo.launch @@ -0,0 +1,19 @@ + + + + + + + + publishing: + - /state + types: + - geometry_msgs/Point + trusted: + - /bar /baz + + + + + diff --git a/launch/server.launch b/launch/server.launch new file mode 100644 index 0000000..7a2db1f --- /dev/null +++ b/launch/server.launch @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/client/client_node.py b/src/client/client_node.py index 71c9009..970eb12 100755 --- a/src/client/client_node.py +++ b/src/client/client_node.py @@ -41,7 +41,7 @@ def create_subscriber(self, topic, msg_type, trusted): def create_callback(self, topic, msg_type, trusted): def callback(msg): data = dict() - data["to"] = trusted + data["to"] = trusted.split(' ') data["from"] = self.name data["topic"] = "/{}{}".format(self.name, topic) data["type"] = msg_type diff --git a/src/server/ws.py b/src/server/ws.py index 827e506..749bce4 100644 --- a/src/server/ws.py +++ b/src/server/ws.py @@ -15,10 +15,10 @@ def __init__(self): self.lat_pubs = dict() def onConnect(self, request): - name = request.path[0:] + name = request.path[1:] common.add_client(name, self) self.name_of_client = name - self.lat_pubs[name[1:]] = rospy.Publisher("/jammi" + name + "/latency", Float32, queue_size=2) + self.lat_pubs[name] = rospy.Publisher("/jammi/" + name + "/latency", Float32, queue_size=2) def onMessage(self, payload, is_binary): if is_binary: @@ -32,13 +32,12 @@ def onMessage(self, payload, is_binary): latency = Float32() latency.data = received_time - msg["stamp"] self.lat_pubs[msg["from"]].publish(latency) - if msg["to"] == "*": + if msg["to"][0] == "*": for name in common.clients.keys(): if name != msg["from"]: common.get_client(name).sendMessage(payload, True) else: - recipients = msg["to"].split(' ') - for name in recipients: + for name in msg["to"]: common.get_client(name).sendMessage(payload, True) except KeyError: pass