7 This code does not effect the runtime of gateways at all - it is used for 8 debugging and monitoring purposes only. 15 import gateway_msgs.srv
as gateway_srvs
16 import gateway_msgs.msg
as gateway_msgs
17 import rocon_gateway_utils
19 from rosgraph.impl.graph
import Edge, EdgeList
20 import rocon_python_comms
30 Utility class for polling statistics from a running gateway-hub network. 35 Creates the polling topics necessary for updating statistics 36 about the running gateway-hub network. 53 self.
_gateway_namespace = rocon_gateway_utils.resolve_local_gateway(timeout=rospy.rostime.Duration(2.0))
58 except rocon_python_comms.NotFoundException
as e:
59 rospy.logerr(
"Gateway Graph: %s" % str(e))
64 return self._local_gateway.name
72 req = gateway_srvs.RemoteGatewayInfoRequest()
77 self.gateway_nodes.append(self._local_gateway.name)
78 self.gateway_nodes.extend([remote_gateway.name
for remote_gateway
in self.
_remote_gateways])
85 for remote_rule
in self._local_gateway.flipped_connections:
86 self.gateway_edges.add(Edge(self._local_gateway.name, remote_rule.remote_rule.gateway))
88 connection_id = rosgraph.impl.graph.topic_node(
89 remote_rule.remote_rule.rule.name +
'-' + remote_rule.remote_rule.rule.type)
90 self.flipped_nodes.append(connection_id)
91 self.flipped_edges.add(Edge(self._local_gateway.name, connection_id))
92 self.flipped_edges.add(Edge(connection_id, remote_rule.remote_rule.gateway))
93 for remote_rule
in self._local_gateway.pulled_connections:
94 connection_id = rosgraph.impl.graph.topic_node(remote_rule.rule.name +
'-' + remote_rule.rule.type)
95 self.pulled_nodes.append(connection_id)
96 self.pulled_edges.add(Edge(self._local_gateway.name, connection_id))
97 self.pulled_edges.add(Edge(connection_id, remote_rule.gateway))
98 for rule
in self._local_gateway.public_interface:
99 connection_id = rosgraph.impl.graph.topic_node(rule.name +
'-' + rule.type)
101 self.pulled_nodes.append(connection_id)
102 self.pulled_edges.add(Edge(self._local_gateway.name, connection_id))
105 for remote_rule
in remote_gateway.flipped_interface:
106 connection_id = rosgraph.impl.graph.topic_node(remote_rule.rule.name +
'-' + remote_rule.rule.type)
107 self.flipped_nodes.append(connection_id)
108 self.flipped_edges.add(Edge(remote_gateway.name, connection_id))
109 self.flipped_edges.add(Edge(connection_id, remote_rule.gateway))
110 self.gateway_edges.add(Edge(remote_gateway.name, remote_rule.gateway))
111 for remote_rule
in remote_gateway.pulled_interface:
112 connection_id = rosgraph.impl.graph.topic_node(remote_rule.rule.name +
'-' + remote_rule.rule.type)
113 self.pulled_nodes.append(connection_id)
114 self.pulled_edges.add(Edge(remote_rule.gateway, connection_id))
115 self.pulled_edges.add(Edge(connection_id, remote_gateway.name))
116 self.gateway_edges.add(Edge(remote_gateway.name, remote_rule.gateway))
def local_gateway_name(self)