Class MasterXmlRpcEndpointImpl

java.lang.Object
org.ros.internal.node.xmlrpc.MasterXmlRpcEndpointImpl
All Implemented Interfaces:
MasterXmlRpcEndpoint, ParameterServerXmlRpcEndpoint, XmlRpcEndpoint

public class MasterXmlRpcEndpointImpl extends Object implements MasterXmlRpcEndpoint, ParameterServerXmlRpcEndpoint
A combined XML-RPC endpoint for the master and parameter servers.
Author:
damonkohler@google.com (Damon Kohler)
  • Constructor Details

    • MasterXmlRpcEndpointImpl

      public MasterXmlRpcEndpointImpl(MasterServer master)
  • Method Details

    • getPid

      public List<Object> getPid(String callerId)
      Description copied from interface: MasterXmlRpcEndpoint
      Get the PID for the master process.
      Specified by:
      getPid in interface MasterXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      Returns:
      The pid of the process.
    • getPublishedTopics

      public List<Object> getPublishedTopics(String callerId, String subgraph)
      Description copied from interface: MasterXmlRpcEndpoint
      Get list of topics that can be subscribed to. This does not return topics that have no publishers. See getSystemState() to get more comprehensive list.
      Specified by:
      getPublishedTopics in interface MasterXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      subgraph - Restrict topic names to match within the specified subgraph. Subgraph namespace is resolved relative to the caller's namespace. Use empty string to specify all names.
      Returns:
      Topics is in list representation [[topic, message type], [topic, message type] ...]
    • getTopicTypes

      public List<Object> getTopicTypes(String callerId)
      Description copied from interface: MasterXmlRpcEndpoint
      Get a list of all topic types.
      Specified by:
      getTopicTypes in interface MasterXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      Returns:
      The types are in the list representation [[topic, message type], [topic, message type] ...]
    • getSystemState

      public List<Object> getSystemState(String callerId)
      Description copied from interface: MasterXmlRpcEndpoint
      Retrieve list representation of system state (i.e. publishers, subscribers, and services).
      Specified by:
      getSystemState in interface MasterXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      Returns:
      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]] ... ]
    • getUri

      public List<Object> getUri(String callerId)
      Description copied from interface: MasterXmlRpcEndpoint
      Get the URI of the the master.
      Specified by:
      getUri in interface MasterXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      Returns:
      URI of the the master
    • lookupNode

      public List<Object> lookupNode(String callerId, String nodeName)
      Description copied from interface: MasterXmlRpcEndpoint
      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.
      Specified by:
      lookupNode in interface MasterXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      nodeName - Name of node to lookup
      Returns:
      URI of the node
    • registerPublisher

      public List<Object> registerPublisher(String callerId, String topicName, String topicMessageType, String callerSlaveUri)
      Description copied from interface: MasterXmlRpcEndpoint
      Register the caller as a publisher the topic.
      Specified by:
      registerPublisher in interface MasterXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      topicName - fully-qualified name of topic to register
      topicMessageType - topic type, must be a package-resource name, i.e. the .msg name.
      callerSlaveUri - API URI of publisher to register
      Returns:
      list of current subscribers of topic in the form of XML-RPC URIs
    • unregisterPublisher

      public List<Object> unregisterPublisher(String callerId, String topicName, String callerSlaveUri)
      Description copied from interface: MasterXmlRpcEndpoint
      Unregister the caller as a publisher of the topic.
      Specified by:
      unregisterPublisher in interface MasterXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      topicName - Fully-qualified name of topic.
      callerSlaveUri - API URI of publisher to unregister. Unregistration will only occur if current registration matches.
      Returns:
      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.
    • registerSubscriber

      public List<Object> registerSubscriber(String callerId, String topicName, String topicMessageType, String callerSlaveUri)
      Description copied from interface: MasterXmlRpcEndpoint
      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.
      Specified by:
      registerSubscriber in interface MasterXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      topicName - Fully-qualified name of topic
      topicMessageType - topic type, must be a package-resource name, i.e. the .msg name
      callerSlaveUri - API URI of subscriber to register. Will be used for new publisher notifications
      Returns:
      publishers as a list of XMLRPC API URIs for nodes currently publishing the specified topic
    • unregisterSubscriber

      public List<Object> unregisterSubscriber(String callerId, String topicName, String callerSlaveUri)
      Description copied from interface: MasterXmlRpcEndpoint
      Unregister the caller as a publisher of the topic.
      Specified by:
      unregisterSubscriber in interface MasterXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      topicName - Fully-qualified name of topic.
      callerSlaveUri - API URI of service to unregister. Unregistration will only occur if current registration matches.
      Returns:
      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.
    • lookupService

      public List<Object> lookupService(String callerId, String serviceName)
      Description copied from interface: MasterXmlRpcEndpoint
      Lookup all provider of a particular service.
      Specified by:
      lookupService in interface MasterXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      serviceName - Fully-qualified name of service
      Returns:
      service URL is provides address and port of the service. Fails if there is no provider.
    • registerService

      public List<Object> registerService(String callerId, String serviceName, String serviceUri, String callerSlaveUri)
      Description copied from interface: MasterXmlRpcEndpoint
      Register the caller as a provider of the specified service.
      Specified by:
      registerService in interface MasterXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      serviceName - Fully-qualified name of service
      serviceUri - XML-RPC URI of caller node
      Returns:
      ignore
    • unregisterService

      public List<Object> unregisterService(String callerId, String serviceName, String serviceUri)
      Description copied from interface: MasterXmlRpcEndpoint
      Unregister the caller as a provider of the specified service.
      Specified by:
      unregisterService in interface MasterXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      serviceName - Fully-qualified name of service
      serviceUri - API URI of service to unregister. Unregistration will only occur if current registration matches.
      Returns:
      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.
    • setParam

      public List<Object> setParam(String callerId, String key, Boolean value)
      Description copied from interface: ParameterServerXmlRpcEndpoint
      Sets a 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.

      Specified by:
      setParam in interface ParameterServerXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      key - Parameter name.
      value - Parameter value.
      Returns:
      void
    • setParam

      public List<Object> setParam(String callerId, String key, Integer value)
      Specified by:
      setParam in interface ParameterServerXmlRpcEndpoint
    • setParam

      public List<Object> setParam(String callerId, String key, Double value)
      Specified by:
      setParam in interface ParameterServerXmlRpcEndpoint
    • setParam

      public List<Object> setParam(String callerId, String key, String value)
      Specified by:
      setParam in interface ParameterServerXmlRpcEndpoint
    • setParam

      public List<Object> setParam(String callerId, String key, List<?> value)
      Specified by:
      setParam in interface ParameterServerXmlRpcEndpoint
    • setParam

      public List<Object> setParam(String callerId, String key, Map<?,?> value)
      Specified by:
      setParam in interface ParameterServerXmlRpcEndpoint
    • getParam

      public List<Object> getParam(String callerId, String key)
      Description copied from interface: ParameterServerXmlRpcEndpoint
      Retrieve parameter value from server.

      If code is not 1, parameterValue should be ignored. 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.

      Specified by:
      getParam in interface ParameterServerXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      key - Parameter name. If key is a namespace, getParam() will return a parameter tree.
      Returns:
      the parameter value
    • searchParam

      public List<Object> searchParam(String callerId, String key)
      Description copied from interface: ParameterServerXmlRpcEndpoint
      Searches for a parameter key on the ParameterServer.

      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). If code is not 1, foundKey should be ignored.

      Specified by:
      searchParam in interface ParameterServerXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      key - Parameter name to search for.
      Returns:
      the found key
    • subscribeParam

      public List<Object> subscribeParam(String callerId, String callerSlaveUri, String key)
      Description copied from interface: ParameterServerXmlRpcEndpoint
      Retrieves the parameter value from server and subscribe to updates to that param. See paramUpdate() in the Node API.

      If code is not 1, parameterValue should be ignored. parameterValue is an empty dictionary if the parameter has not been set yet.

      Specified by:
      subscribeParam in interface ParameterServerXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      callerSlaveUri - Node API URI of subscriber for paramUpdate callbacks.
      Returns:
      the parameter value
    • unsubscribeParam

      public List<Object> unsubscribeParam(String callerId, String callerSlaveUri, String key)
      Description copied from interface: ParameterServerXmlRpcEndpoint
      Unsubscribes from updates to the specified param. See paramUpdate() in the Node API.

      A return value of zero means that the caller was not subscribed to the parameter.

      Specified by:
      unsubscribeParam in interface ParameterServerXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      callerSlaveUri - Node API URI of subscriber
      key - Parameter name
      Returns:
      the number of parameters that were unsubscribed
    • deleteParam

      public List<Object> deleteParam(String callerId, String key)
      Description copied from interface: ParameterServerXmlRpcEndpoint
      Deletes a parameter.
      Specified by:
      deleteParam in interface ParameterServerXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID
      key - parameter name
      Returns:
      void
    • hasParam

      public List<Object> hasParam(String callerId, String key)
      Description copied from interface: ParameterServerXmlRpcEndpoint
      Check if parameter is stored on server.
      Specified by:
      hasParam in interface ParameterServerXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID.
      key - Parameter name.
      Returns:
      true if the parameter exists
    • getParamNames

      public List<Object> getParamNames(String callerId)
      Description copied from interface: ParameterServerXmlRpcEndpoint
      Gets the list of all parameter names stored on this server.
      Specified by:
      getParamNames in interface ParameterServerXmlRpcEndpoint
      Parameters:
      callerId - ROS caller ID.
      Returns:
      a Collection of parameter names