Package rospy :: Package impl :: Module masterslave :: Class ROSHandler

Class ROSHandler

source code

                 object --+    
                          |    
roslib.xmlrpc.XmlRpcHandler --+
                              |
                             ROSHandler

Base handler for both slave and master nodes. API methods generally provide the capability for establishing point-to-point connections with other nodes.

Instance methods are XML-RPC API methods, so care must be taken as to what is added here.

Instance Methods
 
__init__(self, name, master_uri)
Base constructor for ROS nodes/masters
source code
 
getUri(*args, **kwds) source code
 
getName(*args, **kwds) source code
 
getBusStats(*args, **kwds)
Retrieve transport/topic statistics
source code
 
getBusInfo(*args, **kwds)
Retrieve transport/topic connection information
source code
[int, str, str]
getMasterUri(*args, **kwds)
Get the URI of the master node.
source code
[int, str, int]
shutdown(*args, **kwds)
Stop this server
source code
[int, str, int]
getPid(*args, **kwds)
Get the PID of this server
source code
 
getSubscriptions(*args, **kwds)
Retrieve a list of topics that this node subscribes to
source code
[int, str, [ [topic1, topicType1]...[topicN, topicTypeN]]]
getPublications(*args, **kwds)
Retrieve a list of topics that this node publishes.
source code
[int, str, int]
paramUpdate(*args, **kwds)
Callback from master of current publisher list for specified topic.
source code
[int, str, int]
publisherUpdate(*args, **kwds)
Callback from master of current publisher list for specified topic.
source code
[int, str, [str, XmlRpcLegalValue*]]
requestTopic(*args, **kwds)
Publisher node API method called by a subscriber node.
source code

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

Class Methods
list
remappings(cls, methodName)
@internal
source code
Properties

Inherited from object: __class__

Method Details

__init__(self, name, master_uri)
(Constructor)

source code 

Base constructor for ROS nodes/masters

Parameters:
  • name (str) - ROS name of this node
  • master_uri (str) - URI of master node, or None if this node is the master
Overrides: object.__init__

remappings(cls, methodName)
Class Method

source code 

@internal

Parameters:
  • cls (Class: class to register remappings on) - class to register remappings on
Returns: list
parameters (by pos) that should be remapped because they are names

getUri(*args, **kwds)

source code 
Decorators:
  • @apivalidate('')

getName(*args, **kwds)

source code 
Decorators:
  • @apivalidate('')

getBusStats(*args, **kwds)

source code 

Retrieve transport/topic statistics

Parameters:
  • caller_id (str) - ROS caller id
Returns:
[publishStats, subscribeStats, serviceStats]:
  publishStats: [[topicName, messageDataSent, pubConnectionData]...[topicNameN, messageDataSentN, pubConnectionDataN]]
      pubConnectionData: [connectionId, bytesSent, numSent, connected]* . 
  subscribeStats: [[topicName, subConnectionData]...[topicNameN, subConnectionDataN]]
      subConnectionData: [connectionId, bytesReceived, dropEstimate, connected]* . dropEstimate is -1 if no estimate. 
  serviceStats: not sure yet, probably akin to [numRequests, bytesReceived, bytesSent] 
Decorators:
  • @apivalidate([])

getBusInfo(*args, **kwds)

source code 

Retrieve transport/topic connection information

Parameters:
  • caller_id (str) - ROS caller id
Decorators:
  • @apivalidate([])

getMasterUri(*args, **kwds)

source code 

Get the URI of the master node.

Parameters:
  • caller_id (str) - ROS caller id
Returns: [int, str, str]
[code, msg, masterUri]
Decorators:
  • @apivalidate('')

shutdown(*args, **kwds)

source code 

Stop this server

Parameters:
  • caller_id (str) - ROS caller id
  • msg (str) - a message describing why the node is being shutdown.
Returns: [int, str, int]
[code, msg, 0]
Decorators:
  • @apivalidate(0, (None,))

getPid(*args, **kwds)

source code 

Get the PID of this server

Parameters:
  • caller_id (str) - ROS caller id
Returns: [int, str, int]
[1, "", serverProcessPID]
Decorators:
  • @apivalidate(-1)

getSubscriptions(*args, **kwds)

source code 

Retrieve a list of topics that this node subscribes to

Parameters:
  • caller_id (str) - ROS caller id
Decorators:
  • @apivalidate([])

getPublications(*args, **kwds)

source code 

Retrieve a list of topics that this node publishes.

Parameters:
  • caller_id (str) - ROS caller id
Returns: [int, str, [ [topic1, topicType1]...[topicN, topicTypeN]]]
list of topics published by this node
Decorators:
  • @apivalidate([])

paramUpdate(*args, **kwds)

source code 

Callback from master of current publisher list for specified topic.

Parameters:
  • caller_id (str) - ROS caller id
  • parameter_key (str @param parameter_value New parameter value), str - parameter name, globally resolved
  • parameter_value (XMLRPC-legal value)
Returns: [int, str, int]
[code, status, ignore]. If code is -1 ERROR, the node is not subscribed to parameter_key
Decorators:
  • @apivalidate(-1, (global_name('parameter_key'), None))

publisherUpdate(*args, **kwds)

source code 

Callback from master of current publisher list for specified topic.

Parameters:
  • caller_id (str) - ROS caller id
  • topic (str), str - topic name
  • publishers ([str]) - list of current publishers for topic in the form of XMLRPC URIs
Returns: [int, str, int]
[code, status, ignore]
Decorators:
  • @apivalidate(-1, (is_topic('topic'), is_publishers_list('publishers')))

requestTopic(*args, **kwds)

source code 

Publisher node API method called by a subscriber node.

Request that source allocate a channel for communication. Subscriber provides a list of desired protocols for communication. Publisher returns the selected protocol along with any additional params required for establishing connection. For example, for a TCP/IP-based connection, the source node may return a port number of TCP/IP server.

Parameters:
  • caller_id (str), str - ROS caller id
  • topic (str) - topic name
  • protocols ([[str, XmlRpcLegalValue*]]) - list of desired protocols for communication in order of preference. Each protocol is a list of the form [ProtocolName, ProtocolParam1, ProtocolParam2...N]
Returns: [int, str, [str, XmlRpcLegalValue*]]
[code, msg, protocolParams]. protocolParams may be an empty list if there are no compatible protocols.
Decorators:
  • @apivalidate([], (is_topic('topic'), non_empty('protocols')))