Package master_discovery_fkie :: Module master_info :: Class MasterInfo
[frames] | no frames]

Class MasterInfo

source code

object --+
         |
        MasterInfo

The MasterInfo class stores informations about a ROS master. Not thread safe!

Instance Methods
 
__init__(self, masteruri, mastername=None)
Creates a new instance of the MasterInfo.
source code
NodeInfo or None
getNode(self, name)
Returns: the instance of the NodeInfo with given name
source code
NodeInfo or None
getNodeEndsWith(self, suffix)
Returns the node, which name ends with given suffix
source code
NodeInfo or None
getTopic(self, name)
Returns: the instance of the TopicInfo with given name
source code
ServiceInfo or None
getService(self, name)
Returns: the instance of the ServiceInfo with given name
source code
boolean
__eq__(self, other)
Compares the master state with other master state.
source code
 
__ne__(self, other) source code
(boolean, boolean)
has_local_changes(self, other)
Compares the master state with other master state.
source code
(float, float, str, str, [ [str,[str] ] ], [ [str,[str] ] ], [ [str,[str] ] ], [ [str,str] ], [ [str,str,str,int,str] ], [ [str,str,str,str,str] ])
listedState(self)
Returns a extended roscore state.
source code

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

Static Methods
MasterInfo
from_list(l)
Creates a new instance of the MasterInfo from given list.
source code
Instance Variables
  check_ts
the last time, when the state of the ROS master retrieved
Properties
str mastername
Returns the name of the ROS master.
str masteruri
Returns the URI of the ROS master.
float timestamp
The timestamp when this MasterInfo was first time filled with the information.
float timestamp_local
The timestamp when this MasterInfo was first time filled with the information.
dict(str:NodeInfo, ...) nodes
Returns the dictionary with node names and corresponding instances of NodeInfo.
[str, ...] node_names
Returns the list with node names
[str, ...] node_uris
Returns the list with node URI's.
dict(str:TopicInfo, ...) topics
Returns the dictionary with topic names and corresponding TopicInfo instances.
[str, ...] topic_names
Returns the list with topic names.
dict(str:ServiceInfo, ...) services
Returns the dictionary with service names and corresponding ServiceInfo instances.
[str, ...] service_names
Returns the list with service names.
[str, ...] service_uris
Returns the list with service URI's.

Inherited from object: __class__

Method Details

__init__(self, masteruri, mastername=None)
(Constructor)

source code 

Creates a new instance of the MasterInfo. The mastername will be extracted from the masterui, if no name is given.

Parameters:
  • masteruri (str) - The URI of the corresponding master
  • mastername (str or None (Default: None)) - The name of the ROS master. If no one is given, it will be extracted from the masteruri.
Overrides: object.__init__

from_list(l)
Static Method

source code 

Creates a new instance of the MasterInfo from given list.

Parameters:
  • l (list) - the list returned by listedState()
Returns: MasterInfo
the new instance of the MasterInfo filled from list.

See Also: listedState()

getNode(self, name)

source code 
Parameters:
  • name (str) - the name of the node
Returns: NodeInfo or None
the instance of the NodeInfo with given name

getNodeEndsWith(self, suffix)

source code 

Returns the node, which name ends with given suffix

Parameters:
  • suffix (str) - the end of the name
Returns: NodeInfo or None
the instance of the NodeInfo with with given suffix

getTopic(self, name)

source code 
Parameters:
  • name (str) - the name of the topic
Returns: NodeInfo or None
the instance of the TopicInfo with given name

getService(self, name)

source code 
Parameters:
  • name (str) - the name of the service
Returns: ServiceInfo or None
the instance of the ServiceInfo with given name

__eq__(self, other)
(Equality operator)

source code 

Compares the master state with other master state. The timestamp will not be compared.

Parameters:
Returns: boolean
True, if the states are equal.

has_local_changes(self, other)

source code 

Compares the master state with other master state. The timestamp will not be compared.

Parameters:
  • other (MasterInfo @return a tupel with two boolean values (all equal, only local equal)) - the another MasterInfo instance.
Returns: (boolean, boolean)

listedState(self)

source code 

Returns a extended roscore state.

Returns: (float, float, str, str, [ [str,[str] ] ], [ [str,[str] ] ], [ [str,[str] ] ], [ [str,str] ], [ [str,str,str,int,str] ], [ [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, origin ROS_MASTER_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, origin ROS_MASTER_URI, type, { local, remote }]


Property Details

mastername

Returns the name of the ROS master. In most cases the ROS master name is the name of the host, where the ROS master running. Although it can differ.

Get Method:
unreachable.mastername(self) - Returns the name of the ROS master.
Type:
str

masteruri

Returns the URI of the ROS master.

Get Method:
unreachable.masteruri(self) - Returns the URI of the ROS master.
Type:
str

timestamp

The timestamp when this MasterInfo was first time filled with the information. See self.check_ts to get the time, when the information was compared with the data of ROS Master.

Get Method:
unreachable.timestamp(self) - The timestamp when this MasterInfo was first time filled with the information.
Set Method:
unreachable.timestamp(self, ts) - Sets the timestamp of this instance
Type:
float

timestamp_local

The timestamp when this MasterInfo was first time filled with the information. See self.check_ts to get the time, when the information was compared with the data of ROS Master.

Get Method:
unreachable.timestamp_local(self) - The timestamp when this MasterInfo was first time filled with the information.
Set Method:
unreachable.timestamp_local(self, ts) - Sets the timestamp of this instance
Type:
float

nodes

Returns the dictionary with node names and corresponding instances of NodeInfo.

Get Method:
unreachable.nodes(self) - Returns the dictionary with node names and corresponding instances of NodeInfo.
Set Method:
unreachable.nodes(self, name) - Adds a new NodeInfo with given name.
Type:
dict(str:NodeInfo, ...)

node_names

Returns the list with node names

Get Method:
unreachable.node_names(self) - Returns the list with node names
Type:
[str, ...]

node_uris

Returns the list with node URI's.

Get Method:
unreachable.node_uris(self) - Returns the list with node URI's.
Type:
[str, ...]

topics

Returns the dictionary with topic names and corresponding TopicInfo instances.

Get Method:
unreachable.topics(self) - Returns the dictionary with topic names and corresponding TopicInfo instances.
Set Method:
unreachable.topics(self, name) - Adds a new TopicInfo with given name.
Type:
dict(str:TopicInfo, ...)

topic_names

Returns the list with topic names.

Get Method:
unreachable.topic_names(self) - Returns the list with topic names.
Type:
[str, ...]

services

Returns the dictionary with service names and corresponding ServiceInfo instances.

Get Method:
unreachable.services(self) - Returns the dictionary with service names and corresponding ServiceInfo instances.
Set Method:
unreachable.services(self, name) - Adds a new ServiceInfo with given name.
Type:
dict(str:ServiceInfo, ...)

service_names

Returns the list with service names.

Get Method:
unreachable.service_names(self) - Returns the list with service names.
Type:
[str, ...]

service_uris

Returns the list with service URI's.

Get Method:
unreachable.service_uris(self) - Returns the list with service URI's.
Type:
[str, ...]