Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
rocon_gateway.gateway.Gateway Class Reference

Thread. More...

Inheritance diagram for rocon_gateway.gateway.Gateway:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, hub_manager, param, unique_name, publish_gateway_info_callback)
 
def disengage_hub (self, hub)
 
def is_connected (self)
 
def ros_service_advertise (self, request)
 Incoming commands from local system (ros service callbacks) More...
 
def ros_service_advertise_all (self, request)
 
def ros_service_flip (self, request)
 
def ros_service_flip_all (self, request)
 
def ros_service_pull (self, request)
 
def ros_service_pull_all (self, request)
 
def spin (self)
 
def update_flipped_in_interface (self, registrations, remote_gateway_hub_index)
 
def update_flipped_interface (self, local_connection_index, remote_gateway_hub_index)
 Update interface states (jobs assigned from connection_cache callback thread) More...
 
def update_network_information (self)
 
def update_public_interface (self, local_connection_index)
 
def update_pulled_interface (self, unused_connections, remote_gateway_hub_index)
 

Public Attributes

 flipped_interface
 
 hub_manager
 
 ip
 
 master
 
 network_interface_manager
 
 public_interface
 
 pulled_interface
 

Private Member Functions

def _add_flip_rules (self, remotes)
 
def _check_remote_gateways (self, remotes)
 
def _remove_flip_rules (self, remotes)
 
def _ros_service_remote_checks (self, gateway)
 

Private Attributes

 _param
 
 _publish_gateway_info
 
 _unique_name
 

Detailed Description

Thread.

  Used to synchronise with hubs.

Definition at line 36 of file src/rocon_gateway/gateway.py.

Constructor & Destructor Documentation

def rocon_gateway.gateway.Gateway.__init__ (   self,
  hub_manager,
  param,
  unique_name,
  publish_gateway_info_callback 
)
@param hub_manager : container for all the hubs this gateway connects to
@type hub_api.HubManmager

@param param : parameters set by ros_parameters.py
@type : dictionary of parameter key-value pairs

@param unique_name : gateway name (param['name']) with unique uuid hash appended

@param publish_gateway_info_callback : callback for publishing gateway info

Definition at line 42 of file src/rocon_gateway/gateway.py.

Member Function Documentation

def rocon_gateway.gateway.Gateway._add_flip_rules (   self,
  remotes 
)
private
  Add given rules into watcher list

  :param remotes: remote rules
  :type remotes: gateway_msgs.RemoteRule[]
  :return: whether it is successful
  :rtypes: gateway_srvs.RemoteResponse

Definition at line 697 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway._check_remote_gateways (   self,
  remotes 
)
private
  Check given gateways in remote rules are valid

  :param remotes: remote rules
  :type remotes: gateway_msgs.RemoteRule[]

  :return: whether it is valid, error message if it fails
  :rtypes: None or gateway_srvs.RemoteResponse

Definition at line 679 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway._remove_flip_rules (   self,
  remotes 
)
private
  remove given rules into watcher list

  :param remotes: remote rules
  :type remotes: gateway_msgs.RemoteRule[]
  :return: whether it is successful
  :rtypes: gateway_srvs.RemoteResponse

Definition at line 725 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway._ros_service_remote_checks (   self,
  gateway 
)
private
  Some simple checks when pulling or flipping to make sure that the remote gateway is visible. It
  does a strict check on the hash names first, then falls back to looking for weak matches on the
  human friendly name.

  @param gateway : remote gateway target name (can be hash name, basename or regex pattern)
  @type string
  @return pair of result type and message
  @rtype gateway_msgs.ErrorCodes.xxx, string

Definition at line 647 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway.disengage_hub (   self,
  hub 
)
  Disengage from the specified hub. Don't actually need to clean up connections
  here like we do in shutdown - that can be handled from the watcher thread itself.

  @param hub : the hub that will be deleted.

Definition at line 122 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway.is_connected (   self)
  We often check if we're connected to any hubs often just to ensure we
  don't waste time processing if there is no-one listening.

  @return True if at least one hub is connected, False otherwise
  @rtype Bool

Definition at line 112 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway.ros_service_advertise (   self,
  request 
)

Incoming commands from local system (ros service callbacks)

  Puts/Removes a number of rules on the public interface watchlist.
  As local rules matching these rules become available/go away,
  the public interface is modified accordingly. A manual update is done
  at the end of the advertise call to quickly capture existing
  rules

  @param request
  @type gateway_srvs.AdvertiseRequest
  @return service response
  @rtgateway_srvs.srv.AdvertiseReponse

Definition at line 434 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway.ros_service_advertise_all (   self,
  request 
)
  Toggles the advertise all mode. If advertising all, an additional
  blacklist parameter can be supplied which includes all the topics that
  will not be advertised/watched for. This blacklist is added to the
  default blacklist of the public interface

  @param request
  @type gateway_srvs.AdvertiseAllRequest
  @return service response
  @rtype gateway_srvs.AdvertiseAllReponse

Definition at line 474 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway.ros_service_flip (   self,
  request 
)
  Puts flip rules on a watchlist which (un)flips them when they
  become (un)available.

  @param request
  @type gateway_srvs.RemoteRequest
  @return service response
  @rtype gateway_srvs.RemoteResponse

Definition at line 507 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway.ros_service_flip_all (   self,
  request 
)
  Flips everything except a specified blacklist to a particular gateway,
  or if the cancel flag is set, clears all flips to that gateway.

  @param request
  @type gateway_srvs.RemoteAllRequest
  @return service response
  @rtype gateway_srvs.RemoteAllResponse

Definition at line 540 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway.ros_service_pull (   self,
  request 
)
  Puts a single rule on a watchlist and pulls it from a particular
  gateway when it becomes (un)available.

  @param request
  @type gateway_srvs.RemoteRequest
  @return service response
  @rtype gateway_srvs.RemoteResponse

Definition at line 570 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway.ros_service_pull_all (   self,
  request 
)
  Pull everything except a specified blacklist from a particular gateway,
  or if the cancel flag is set, clears all pulls from that gateway.

  @param request
  @type gateway_srvs.RemoteAllRequest
  @return service response
  @rtype gateway_srvs.RemoteAllResponse

Definition at line 617 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway.spin (   self)

Definition at line 91 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway.update_flipped_in_interface (   self,
  registrations,
  remote_gateway_hub_index 
)
  Match the flipped in connections to supplied registrations using
  supplied registrations, flipping and unflipping as necessary.

  @param registrations : registrations (with status) to be processed
  @type list of (utils.Registration, str) where the str contains the status

Definition at line 321 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway.update_flipped_interface (   self,
  local_connection_index,
  remote_gateway_hub_index 
)

Update interface states (jobs assigned from connection_cache callback thread)

  Process the list of local connections and check against
  the current flip rules and patterns for changes. If a rule
  has become (un)available take appropriate action.

  @param local_connection_index : list of current local connections
  @type : dictionary of ConnectionType.xxx keyed sets of utils.Connections

  @param gateways : list of remote gateway string id's
  @type string

Definition at line 136 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway.update_network_information (   self)
  If we are running over a wired connection, then do nothing.
  If over the wireless, updated data transfer rate and signal strength
  for this gateway on the hub

Definition at line 400 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway.update_public_interface (   self,
  local_connection_index 
)
  Process the list of local connections and check against
  the current rules and patterns for changes. If a rule
  has become (un)available take appropriate action.

  @param local_connection_index : list of current local connections parsed from the master
  @type : { utils.ConnectionType.xxx : utils.Connection[] } dictionaries

Definition at line 291 of file src/rocon_gateway/gateway.py.

def rocon_gateway.gateway.Gateway.update_pulled_interface (   self,
  unused_connections,
  remote_gateway_hub_index 
)
  Process the list of local connections and check against
  the current pull rules and patterns for changes. If a rule
  has become (un)available take appropriate action.

  This is called by the watcher thread. The remote_gateway_hub_index
  is always a full dictionary of all remote gateway and hub key-value
  pairs - it is only included as an argument here to save
  processing doubly in the watcher thread.

  @param connections : list of current local connections parsed from the master
  @type : dictionary of ConnectionType.xxx keyed lists of utils.Connections

  @param remote_gateway_hub_index : key-value remote gateway name-hub list pairs
  @type dictionary of remote_gateway_name-list of hub_api.Hub objects key-value pairs

Definition at line 220 of file src/rocon_gateway/gateway.py.

Member Data Documentation

rocon_gateway.gateway.Gateway._param
private

Definition at line 67 of file src/rocon_gateway/gateway.py.

rocon_gateway.gateway.Gateway._publish_gateway_info
private

Definition at line 69 of file src/rocon_gateway/gateway.py.

rocon_gateway.gateway.Gateway._unique_name
private

Definition at line 68 of file src/rocon_gateway/gateway.py.

rocon_gateway.gateway.Gateway.flipped_interface

Definition at line 72 of file src/rocon_gateway/gateway.py.

rocon_gateway.gateway.Gateway.hub_manager

Definition at line 54 of file src/rocon_gateway/gateway.py.

rocon_gateway.gateway.Gateway.ip

Definition at line 66 of file src/rocon_gateway/gateway.py.

rocon_gateway.gateway.Gateway.master

Definition at line 55 of file src/rocon_gateway/gateway.py.

rocon_gateway.gateway.Gateway.network_interface_manager

Definition at line 88 of file src/rocon_gateway/gateway.py.

rocon_gateway.gateway.Gateway.public_interface

Definition at line 81 of file src/rocon_gateway/gateway.py.

rocon_gateway.gateway.Gateway.pulled_interface

Definition at line 78 of file src/rocon_gateway/gateway.py.


The documentation for this class was generated from the following file:


rocon_gateway
Author(s): Daniel Stonier , Jihoon Lee , Piyush Khandelwal
autogenerated on Mon Jun 10 2019 14:40:10