API for interacting with the ROS master. Although the Master is relatively simple to interact with using the XMLRPC API, this abstraction layer provides protection against future updates. It also provides a streamlined API with builtin return code checking and caller_id passing.
Method | __init__ |
No summary |
Method | delete |
Parameter Server: delete parameter @param key: parameter name @type key: str @return: 0 @rtype: int |
Method | get |
Retrieve parameter value from server. @param key: parameter to lookup. If key is a namespace, getParam() will return a parameter tree. @type key: str getParam() will return a parameter tree. |
Method | get |
Get list of all parameter names stored on this server. This does not adjust parameter names for caller's scope. |
Method | get |
Get the PID of this server @return: serverProcessPID @rtype: int @raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE. |
Method | get |
Get list of topics that can be subscribed to. This does not return topics that have no publishers. See L{getSystemState()} to get more comprehensive list. @param subgraph: Restrict topic names to match within the specified subgraph... |
Method | get |
Retrieve list representation of system state (i.e. publishers, subscribers, and services). @rtype: [[str,[str]], [str,[str]], [str,[str]]] @return: systemState |
Method | get |
Retrieve list topic names and their types. |
Method | get |
Get the URI of this Master @return: masterUri @rtype: str @raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE. |
Method | has |
Check if parameter is stored on server. @param key: parameter to check @type key: str @return: [code, statusMessage, hasParam] @rtype: [int, str, bool] |
Method | is |
Check if Master is online. |
Method | lookup |
Get the XML-RPC URI of the node with the associated name/caller_id. This API is for looking information about publishers and subscribers. Use lookupService instead to lookup ROS-RPC URIs. @param node: name of node to lookup @type node: str @return: URI @rtype: str @raise rosgraph... |
Method | lookup |
Lookup all provider of a particular service. @param service: fully-qualified name of service to lookup. @type: service: str @return (int, str, str): (code, message, serviceUrl). service URL is provides... |
Method | register |
Register the caller as a publisher the topic. @param topic: Fully-qualified name of topic to register. @type topic: str @param topic_type: Datatype for topic. Must be a package-resource name, i.e. the... |
Method | register |
Register the caller as a provider of the specified service. @param service str: Fully-qualified name of service @param service_api str: Service URI @param caller_api str: XML-RPC URI of caller node @return: ignore @rtype: int @raise rosgraph... |
Method | register |
Subscribe the caller to the specified topic. In addition to receiving a list of current publishers, the subscriber will also receive notifications of new publishers via the publisherUpdate API. @param topic str: Fully-qualified name of topic to subscribe to... |
Method | search |
Search for parameter key on parameter server. Search starts in caller's namespace and proceeds upwards through parent namespaces until Parameter Server finds a matching key. |
Method | set |
Parameter Server: set parameter. NOTE: if value is a dictionary it will be treated as a parameter tree, where key is the parameter namespace. For example:: |
Method | subscribe |
Retrieve parameter value from server and subscribe to updates to that param. See paramUpdate() in the Node API. @param key: parameter to lookup. @type key: str @param caller_api: API URI for paramUpdate callbacks... |
Method | unregister |
Unregister the caller as a publisher of the topic. @param topic: Fully-qualified name of topic to unregister. @type topic: str @param caller_api str: API URI of service to |
Method | unregister |
Unregister the caller as a provider of the specified service. @param service: Fully-qualified name of service @type service: str @param service_api: API URI of service to unregister. Unregistration will only occur if current... |
Method | unregister |
Unregister the caller as a publisher of the topic. @param topic: Fully-qualified name of topic to unregister. @type topic: str @param caller_api: API URI of service to unregister. Unregistration will only occur if current @type caller_api: str... |
Method | unsubscribe |
Retrieve parameter value from server and subscribe to updates to that param. See paramUpdate() in the Node API. @param key: parameter to lookup. @type key: str @param caller_api: API URI for paramUpdate callbacks... |
Instance Variable | caller |
Undocumented |
Instance Variable | handle |
Undocumented |
Instance Variable | master |
Undocumented |
Method | _reinit |
Internal API for reinitializing this handle to be a new master |
Method | _succeed |
Check master return code and return the value field. |
Parameters | |
caller | name of node to use in calls to master, str |
master | (optional) override default ROS master URI, str |
Raises | |
Unknown exception | ValueError If ROS master uri not set properly |
Retrieve parameter value from server. @param key: parameter to lookup. If key is a namespace, getParam() will return a parameter tree. @type key: str getParam() will return a parameter tree.
- @return: parameterValue. If key is a namespace,
- the return value will be a dictionary, where each key is a parameter in that namespace. Sub-namespaces are also represented as dictionaries.
@rtype: XMLRPCLegalValue
Get list of all parameter names stored on this server. This does not adjust parameter names for caller's scope.
@return: [code, statusMessage, parameterNameList] @rtype: [int, str, [str]]
Get the PID of this server @return: serverProcessPID @rtype: int @raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE.
Get list of topics that can be subscribed to. This does not return topics that have no publishers. See L{getSystemState()} to get more comprehensive list. @param subgraph: Restrict topic names to match within the specified subgraph. Subgraph namespace
is resolved relative to the caller's namespace. Use '' to specify all names.
@type subgraph: str @return: [[topic1, type1]...[topicN, typeN]] @rtype: [[str, str],] @raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE.
Retrieve list representation of system state (i.e. publishers, subscribers, and services). @rtype: [[str,[str]], [str,[str]], [str,[str]]] @return: systemState
- System state is in list representation::
- [publishers, subscribers, services].
- publishers is of the form::
- [ [topic1, [topic1Publisher1...topic1PublisherN]] ... ]
- subscribers is of the form::
- [ [topic1, [topic1Subscriber1...topic1SubscriberN]] ... ]
- services is of the form::
- [ [service1, [service1Provider1...service1ProviderN]] ... ]
@raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE.
Retrieve list topic names and their types.
New in ROS 1.2.
@rtype: (int, str, [[str,str]] ) @return: (code, statusMessage, topicTypes). topicTypes is a list of [topicName, topicType] pairs.
Get the URI of this Master @return: masterUri @rtype: str @raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE.
Check if parameter is stored on server. @param key: parameter to check @type key: str @return: [code, statusMessage, hasParam] @rtype: [int, str, bool]
Check if Master is online.
NOTE: this is not part of the actual Master API. This is a convenience function.
@param master_uri: (optional) override environment's ROS_MASTER_URI @type master_uri: str @return: True if Master is available
Get the XML-RPC URI of the node with the associated name/caller_id. This API is for looking information about publishers and subscribers. Use lookupService instead to lookup ROS-RPC URIs. @param node: name of node to lookup @type node: str @return: URI @rtype: str @raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE.
Lookup all provider of a particular service. @param service: fully-qualified name of service to lookup. @type: service: str @return (int, str, str): (code, message, serviceUrl). service URL is provides
and address and port of the service. Fails if there is no provider.
@raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE.
Register the caller as a publisher the topic. @param topic: Fully-qualified name of topic to register. @type topic: str @param topic_type: Datatype for topic. Must be a package-resource name, i.e. the .msg name. @type topic_type: str @param caller_api str: ROS caller XML-RPC API URI @type caller_api: str @return: subscriberApis. List of current subscribers of topic in the form of XMLRPC URIs. @rtype: [str] @raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE.
Register the caller as a provider of the specified service. @param service str: Fully-qualified name of service @param service_api str: Service URI @param caller_api str: XML-RPC URI of caller node @return: ignore @rtype: int @raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE.
Subscribe the caller to the specified topic. In addition to receiving a list of current publishers, the subscriber will also receive notifications of new publishers via the publisherUpdate API. @param topic str: Fully-qualified name of topic to subscribe to. @param topic_type: Datatype for topic. Must be a package-resource name, i.e. the .msg name. @type topic_type: str @param caller_api: XML-RPC URI of caller node for new publisher notifications @type caller_api: str @return: (code, message, publishers). Publishers is a list of XMLRPC API URIs
for nodes currently publishing the specified topic.
@rtype: (int, str, list(str)) @raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE.
Search for parameter key on parameter server. Search starts in caller's namespace and proceeds upwards through parent namespaces until Parameter Server finds a matching key.
searchParam's behavior is to search for the first partial match. For example, imagine that there are two 'robot_description' parameters:
/robot_description /robot_description/arm /robot_description/base /pr2/robot_description /pr2/robot_description/base
If I start in the namespace /pr2/foo and search for 'robot_description', searchParam will match /pr2/robot_description. If I search for 'robot_description/arm' it will return /pr2/robot_description/arm, even though that parameter does not exist (yet).
@param key: parameter key to search for. @type key: str @return: foundKey @rtype: str
Parameter Server: set parameter. NOTE: if value is a dictionary it will be treated as a parameter tree, where key is the parameter namespace. For example::
{'x':1,'y':2,'sub':{'z':3}}
will set key/x=1, key/y=2, and key/sub/z=3. Furthermore, it will replace all existing parameters in the key parameter namespace with the parameters in value. You must set parameters individually if you wish to perform a union update.
@param key: parameter name @type key: str @param value: parameter value. @type value: XMLRPCLegalValue @return: 0 @rtype: int
Retrieve parameter value from server and subscribe to updates to that param. See paramUpdate() in the Node API. @param key: parameter to lookup. @type key: str @param caller_api: API URI for paramUpdate callbacks. @type caller_api: str @return: parameterValue. parameterValue is an empty dictionary if the parameter has not been set yet. @rtype: XMLRPCLegalValue
Unregister the caller as a publisher of the topic. @param topic: Fully-qualified name of topic to unregister. @type topic: str @param caller_api str: API URI of service to
unregister. Unregistration will only occur if current registration matches.
@type caller_api: str @return: numUnregistered.
If numUnregistered is zero it means that the caller was not registered as a publisher. The call still succeeds as the intended final state is reached.
@rtype: int @raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE.
Unregister the caller as a provider of the specified service. @param service: Fully-qualified name of service @type service: str @param service_api: API URI of service to unregister. Unregistration will only occur if current
registration matches.
@type service_api: str @return: (code, message, numUnregistered). Number of unregistrations (either 0 or 1).
If this is zero it means that the caller was not registered as a service provider. The call still succeeds as the intended final state is reached.
@rtype: (int, str, int) @raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE.
Unregister the caller as a publisher of the topic. @param topic: Fully-qualified name of topic to unregister. @type topic: str @param caller_api: API URI of service to unregister. Unregistration will only occur if current @type caller_api: str
registration matches.
- @return: (code, statusMessage, numUnsubscribed).
- If numUnsubscribed is zero it means that the caller was not registered as a subscriber. The call still succeeds as the intended final state is reached.
@rtype: (int, str, int) @raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE.
Retrieve parameter value from server and subscribe to updates to that param. See paramUpdate() in the Node API. @param key: parameter to lookup. @type key: str @param caller_api: API URI for paramUpdate callbacks. @type caller_api: str @return: numUnsubscribed. If numUnsubscribed is zero it means that the caller was not subscribed to the parameter. @rtype: int
Internal API for reinitializing this handle to be a new master
Raises | |
Unknown exception | ValueError If ROS master uri not set |
Check master return code and return the value field.
@param args: master return value @type args: (int, str, XMLRPCLegalValue) @return: value field of args (master return value) @rtype: XMLRPCLegalValue @raise rosgraph.masterapi.Error: if Master returns ERROR. @raise rosgraph.masterapi.Failure: if Master returns FAILURE.