Package master_discovery_fkie :: Module master_monitor :: Class MasterMonitor
[frames] | no frames]

Class MasterMonitor

source code

object --+
         |
        MasterMonitor

This class provides methods to get the state from the ROS master using his RPC API and test for changes. Furthermore an XML-RPC server will be created to offer the complete current state of the ROS master by one method call.


See Also:
getState() RPC Methods:, getListedMasterInfo() or getMasterContacts() as RPC: masterInfo() and masterContacts()
Instance Methods
 
__init__(self, rpcport=11611)
Initialize method.
source code
 
shutdown(self)
Shutdown the RPC Server.
source code
 
getCurrentState(self) source code
MasterInfo
updateState(self, clear_cache=False)
Gets state from the ROS master through his RPC interface.
source code
 
updateSyncInfo(self)
This method can be called to update the origin ROS master URI of the nodes and services in new master_state.
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
str or None
getMastername(self)
Returns the name of the master.
source code
boolean
checkState(self, clear_cache=False)
Gets the state from the ROS master and compares it to the stored state.
source code
 
reset(self)
Sets the master state to None.
source code

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

    RPC-methods
(float, float, str, str, [ [str,[str] ] ], [ [str,[str] ] ], [ [str,[str] ] ], [ [str,str] ], [ [str,str,int,str] ], [ [str,str,str,str] ])
getListedMasterInfo(self)
Returns a extended roscore state.
source code
(str, str, str, str, str)
getMasterContacts(self)
The RPC method called by XML-RPC server to request the master contact information.
source code
Class Variables
  MAX_PING_SEC = 10.0
Instance Variables
  rpcport
the port number of the RPC server
Properties

Inherited from object: __class__

Method Details

__init__(self, rpcport=11611)
(Constructor)

source code 

Initialize method. Creates an XML-RPC server on given port and starts this in its own thread.

Parameters:
  • rpcport (int) - the port number for the XML-RPC server
Overrides: object.__init__

getListedMasterInfo(self)

source code 

Returns a extended roscore state.

Returns: (float, float, str, str, [ [str,[str] ] ], [ [str,[str] ] ], [ [str,[str] ] ], [ [str,str] ], [ [str,str,int,str] ], [ [str,str,str,str] ])
complete roscore state as

(stamp, stamp_local, masteruri, name, publishers, subscribers, services, topicTypes, nodes, serviceProvider)

  • publishers is of the form

    [ [topic1, [topic1Publisher1...topic1PublisherN]] ... ]

  • subscribers is of the form

    [ [topic1, [topic1Subscriber1...topic1SubscriberN]] ... ]

  • services is of the form

    [ [service1, [service1Provider1...service1ProviderN]] ... ]

  • topicTypes is a list of

    [[topicName1, topicType1], ... ]

  • nodes is a list of (the pid of remote Nodes will not be resolved)

    [nodename, XML-RPC URI, pid, { local, remote }]

  • serviceProvider is a list of (the type, serviceClass and args of remote Services will not be resolved)

    [service, XML-RPC URI, type, { local, remote }]

updateState(self, clear_cache=False)

source code 

Gets state from the ROS master through his RPC interface.

Returns: MasterInfo
Raises:

updateSyncInfo(self)

source code 

This method can be called to update the origin ROS master URI of the nodes and services in new master_state. This is only need, if a synchronization is running. The synchronization service will be detect automatically by searching for the service ending with get_sync_info. The method will be called by checkState().

getMasteruri(self)

source code 

Requests the ROS master URI from the ROS master through the RPC interface and returns it.

Returns: str or None
ROS master URI

getMastername(self)

source code 

Returns the name of the master. If no name is set, the hostname of the ROS master URI will be extracted.

Returns: str or None
the name of the ROS master

getMasterContacts(self)

source code 

The RPC method called by XML-RPC server to request the master contact information.

Returns: (str, str, str, str, str)
(timestamp of the ROS master state, ROS master URI, master name, name of this service, URI of this RPC server)

checkState(self, clear_cache=False)

source code 

Gets the state from the ROS master and compares it to the stored state. @param clear_cache Clears cache for ROS nodes and sevices. Is neaded on changes on remote hosts.

Returns: boolean
True if the ROS master state is changed