Package rocon_gateway :: Module gateway_hub :: Class GatewayHub
[frames] | no frames]

Class GatewayHub

source code

                     object --+    
                              |    
rocon_hub_client.hub_client.Hub --+
                                  |
                                 GatewayHub

Instance Methods
 
__init__(self, ip, port, whitelist, blacklist)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
register_gateway(self, firewall, unique_gateway_name, remote_gateway_request_callbacks, hub_connection_lost_gateway_hook, gateway_ip)
Register a gateway with the hub.
source code
bool
unregister_gateway(self)
Remove all gateway info from the hub.
source code
 
remote_gateway_info(self, gateway)
Return remote gateway information for the specified gateway string id.
source code
 
list_remote_gateway_names(self)
Return a list of the gateways (name list, not redis keys).
source code
 
matches_remote_gateway_name(self, gateway)
Use this when gateway can be a regular expression and we need to check it off against list_remote_gateway_names()
source code
 
matches_remote_gateway_basename(self, gateway)
Use this when gateway can be a regular expression and we need to check it off against list_remote_gateway_names()
source code
 
get_remote_connection_state(self, remote_gateway)
Equivalent to get_connection_state, but generates it from the public interface of a remote gateway
source code
 
get_remote_gateway_firewall_flag(self, gateway)
Returns the value of the remote gateway's firewall (flip) flag.
source code
 
advertise(self, connection)
Places a topic, service or action on the public interface.
source code
 
unadvertise(self, connection)
Removes a topic, service or action from the public interface.
source code
 
post_flip_details(self, gateway, name, connection_type, node)
Post flip details to the redis server.
source code
 
remove_flip_details(self, gateway, name, connection_type, node)
Post flip details to the redis server.
source code
 
post_pull_details(self, gateway, name, connection_type, node)
Post pull details to the hub.
source code
 
remove_pull_details(self, gateway, name, connection_type, node)
Post pull details to the hub.
source code
 
send_flip_request(self, remote_gateway, connection)
Sends a message to the remote gateway via redis pubsub channel.
source code
 
send_unflip_request(self, remote_gateway, rule) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, ip, port, whitelist, blacklist)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • remote_gateway_request_callbacks - to handle redis responses @type list of function pointers (back to GatewaySync class
  • ip - redis server ip
  • port - redis server port

    @raise HubNameNotFoundError, HubNotFoundError

Overrides: object.__init__

register_gateway(self, firewall, unique_gateway_name, remote_gateway_request_callbacks, hub_connection_lost_gateway_hook, gateway_ip)

source code 

Register a gateway with the hub.

@param firewall @param unique_gateway_name @param remote_gateway_request_callbacks

Parameters:
  • hub_connection_lost_hook - used to trigger Gateway.disengage_hub(hub) on lost hub connections in redis pubsub listener thread. @gateway_ip

    @raise HubConnectionLostError if for some reason, the redis server has become unavailable.

unregister_gateway(self)

source code 

Remove all gateway info from the hub.

Returns: bool
success or failure of the operation

remote_gateway_info(self, gateway)

source code 

Return remote gateway information for the specified gateway string id.

Parameters:
  • gateways - gateway id string to search for @type string @return remote gateway information @rtype gateway_msgs.RemotGateway or None

list_remote_gateway_names(self)

source code 

Return a list of the gateways (name list, not redis keys). e.g. ['gateway32adcda32','pirate21fasdf']. If not connected, just returns an empty list.

matches_remote_gateway_name(self, gateway)

source code 

Use this when gateway can be a regular expression and we need to check it off against list_remote_gateway_names()

@return a list of matches (higher level decides on action for duplicates).

get_remote_connection_state(self, remote_gateway)

source code 

Equivalent to get_connection_state, but generates it from the public interface of a remote gateway

Parameters:
  • remote_gateway - hash name for a remote gateway @type str @return dictionary of remote advertisements @rtype dictionary of connection type keyed connection values

get_remote_gateway_firewall_flag(self, gateway)

source code 

Returns the value of the remote gateway's firewall (flip) flag.

Parameters:
  • gateway - gateway string id @param string

    @return state of the flag @rtype Bool

    @raise GatewayUnavailableError when specified gateway is not on the hub

advertise(self, connection)

source code 

Places a topic, service or action on the public interface. On the redis server, this representation will always be:

  • topic : a triple { name, type, xmlrpc node uri }
  • service : a triple { name, rosrpc uri, xmlrpc node uri }
  • action : ???
Parameters:
  • connection (str) - representation of a connection (topic, service, action)
Raises:
  • .exceptions.ConnectionTypeError - if connection arg is invalid.

unadvertise(self, connection)

source code 

Removes a topic, service or action from the public interface.

Parameters:
  • connection (str) - representation of a connection (topic, service, action)
Raises:
  • .exceptions.ConnectionTypeError - if connectionarg is invalid.

post_flip_details(self, gateway, name, connection_type, node)

source code 

Post flip details to the redis server. This has no actual functionality, it is just useful for debugging with the remote_gateway_info service.

Parameters:
  • gateway - the target of the flip @type string
  • name - the name of the connection @type string
  • type - the type of the connection (one of ConnectionType.xxx @type string
  • node - the node name it was pulled from @type string

remove_flip_details(self, gateway, name, connection_type, node)

source code 

Post flip details to the redis server. This has no actual functionality, it is just useful for debugging with the remote_gateway_info service.

Parameters:
  • gateway - the target of the flip @type string
  • name - the name of the connection @type string
  • type - the type of the connection (one of ConnectionType.xxx @type string
  • node - the node name it was pulled from @type string

post_pull_details(self, gateway, name, connection_type, node)

source code 

Post pull details to the hub. This has no actual functionality, it is just useful for debugging with the remote_gateway_info service.

Parameters:
  • gateway - the gateway it is pulling from @type string
  • name - the name of the connection @type string
  • type - the type of the connection (one of ConnectionType.xxx @type string
  • node - the node name it was pulled from @type string

remove_pull_details(self, gateway, name, connection_type, node)

source code 

Post pull details to the hub. This has no actual functionality, it is just useful for debugging with the remote_gateway_info service.

Parameters:
  • gateway - the gateway it was pulling from @type string
  • name - the name of the connection @type string
  • type - the type of the connection (one of ConnectionType.xxx @type string
  • node - the node name it was pulled from @type string

send_flip_request(self, remote_gateway, connection)

source code 

Sends a message to the remote gateway via redis pubsub channel. This is called from the watcher thread, when a flip rule gets activated.

  • redis channel name: rocon:<remote_gateway_name>
  • data : list of [ command, gateway, rule type, type, xmlrpc_uri ]
    • [0] - command : in this case 'flip'
    • [1] - gateway : the name of this gateway, i.e. the flipper
    • [2] - name : local name
    • [3] - node : local node name
    • [4] - connection_type : one of ConnectionType.PUBLISHER etc
    • [5] - type_info : a ros format type (e.g. std_msgs/String or service api)
    • [6] - xmlrpc_uri : the xmlrpc node uri
Parameters:
  • command - string command name - either 'flip' or 'unflip' @type str
  • flip_rule - the flip to send @type gateway_msgs.RemoteRule
  • type_info - topic type (e.g. std_msgs/String) @param str
  • xmlrpc_uri - the node uri @param str