Package master_sync_fkie :: Module master_sync :: Class Main
[frames] | no frames]

Class Main

source code

object --+
         |
        Main

Instance Methods
 
__init__(self)
Creates a new instance.
source code
 
handlerMasterStateMsg(self, data)
The method to handle the received MasterState messages.
source code
str or None
getMasteruri(self)
Requests the ROS master URI from the ROS master through the RPC interface and returns it.
source code
 
retrieveMasters(self)
This method use the service 'list_masters' of the master_discoverer to get the list of discovered ROS master.
source code
 
updateMaster(self, mastername, masteruri, timestamp, timestamp_local, discoverer_name, monitoruri)
Updates the timestamp of the given ROS master, or creates a new SyncThread to synchronize the local master with given ROS master.
source code
 
get_own_state(self, monitoruri) source code
 
removeMaster(self, ros_master_name)
Removes the master with given name from the synchronization list.
source code
 
finish(self, msg='')
Removes all remote masters and unregister their topics and services.
source code
 
rosservice_get_sync_info(self, req)
Callback for the ROS service to get the info to synchronized nodes.
source code

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

Class Variables
  UPDATE_INTERVALL = 30
Instance Variables
  materuri
the ROS master URI of the local ROS master.
  sub_changes
{dict} with topics (name: rospy.Subscriber) publishes the changes of the discovered ROS masters.
Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

Creates a new instance. Find the topic of the master_discovery node using master_discovery_fkie.interface_finder.get_changes_topic(). Also the parameter ~ignore_hosts will be analyzed to exclude hosts from sync.

Overrides: object.__init__

handlerMasterStateMsg(self, data)

source code 

The method to handle the received MasterState messages. Based on this message new threads to synchronize with remote ROS master will be created, updated or removed.

Parameters:
  • data (master_discovery_fkie.MasterState) - the received message

getMasteruri(self)

source code 

Requests the ROS master URI from the ROS master through the RPC interface and returns it. The 'materuri' attribute will be set to the requested value.

Returns: str or None
ROS master URI

retrieveMasters(self)

source code 

This method use the service 'list_masters' of the master_discoverer to get the list of discovered ROS master. Based on this list the SyncThread for synchronization will be created.

See Also: master_discovery_fkie.interface_finder.get_listmaster_service()

updateMaster(self, mastername, masteruri, timestamp, timestamp_local, discoverer_name, monitoruri)

source code 

Updates the timestamp of the given ROS master, or creates a new SyncThread to synchronize the local master with given ROS master.

Parameters:
  • mastername (str) - the name of the remote ROS master to update or synchronize.
  • masteruri (str) - the URI of the remote ROS master.
  • timestamp (float64) - the timestamp of the remote ROS master.
  • timestamp_local (float64) - the timestamp of the remote ROS master. (only local changes)
  • discoverer_name (str) - the name of the remote master_discoverer node
  • monitoruri (str) - the URI of the RPC interface of the remote master_discoverer node.

removeMaster(self, ros_master_name)

source code 

Removes the master with given name from the synchronization list.

Parameters:
  • ros_master_name (str) - the name of the ROS master to remove.