Package rosmaster :: Module master_api

Module master_api

source code

ROS Master API.

ROSMasterHandler provides the API implementation of the Master. Python allows an API to be introspected from a Python class, so the handler has a 1-to-1 mapping with the actual XMLRPC API.

API return convention: (statusCode, statusMessage, returnValue)

Current status codes:

Individual methods may assign additional meaning/semantics to statusCode.

Classes
  ROSMasterHandler
XML-RPC handler for ROS master APIs.
Functions
 
mloginfo(msg, *args)
Info-level master log statements.
source code
 
mlogwarn(msg, *args)
Warn-level master log statements.
source code
 
apivalidate(error_return_value, validators=())
ROS master/slave arg-checking decorator.
source code
 
publisher_update_task(api, topic, pub_uris)
Contact api.publisherUpdate with specified parameters
source code
 
service_update_task(api, service, uri)
Contact api.serviceUpdate with specified parameters
source code
Variables
  NUM_WORKERS = 3
  STATUS = 0
  MSG = 1
  VAL = 2
  LOG_API = False
  __package__ = 'rosmaster'
Function Details

mloginfo(msg, *args)

source code 

Info-level master log statements. These statements may be printed to screen so they should be user-readable.

Parameters:
  • msg (str) - Message string
  • args - arguments for msg if msg is a format string

mlogwarn(msg, *args)

source code 

Warn-level master log statements. These statements may be printed to screen so they should be user-readable.

Parameters:
  • msg (str) - Message string
  • args - arguments for msg if msg is a format string

apivalidate(error_return_value, validators=())

source code 

ROS master/slave arg-checking decorator. Applies the specified validator to the corresponding argument and also remaps each argument to be the value returned by the validator. Thus, arguments can be simultaneously validated and canonicalized prior to actual function call.

Parameters:
  • error_return_value - API value to return if call unexpectedly fails
  • validators (sequence) - sequence of validators to apply to each arg. None means no validation for the parameter is required. As all api methods take caller_id as the first parameter, the validators start with the second param.

publisher_update_task(api, topic, pub_uris)

source code 

Contact api.publisherUpdate with specified parameters

Parameters:
  • api (str) - XML-RPC URI of node to contact
  • topic (str) - Topic name to send to node
  • pub_uris ([str]) - list of publisher APIs to send to node

service_update_task(api, service, uri)

source code 

Contact api.serviceUpdate with specified parameters

Parameters:
  • api (str) - XML-RPC URI of node to contact
  • service (str) - Service name to send to node
  • uri (str) - URI to send to node