package documentation

ROS client library for Python. See U{http://ros.org/wiki/rospy} @author: Ken Conley (kwc)

Module client Additional ROS client API methods.
Module core rospy internal core implementation library
Module exceptions rospy exception types
Package impl No package docstring; 12/14 modules documented
Module logger_level_service_caller No module docstring; 1/1 exception, 1/1 class documented
Module msg Internal use: Support for ROS messages, including network serialization routines
Module msproxy Master/Slave XML-RPC Wrappers.
Module names Support for ROS Names
Module numpy_msg Support for using numpy with rospy messages.
Module rosconsole Undocumented
Module rostime ROS time and duration representations, as well as internal routines for managing wallclock versus a simulated clock. The important data classes are L{Time} and L{Duration}, which represent the ROS 'time' and 'duration' primitives, respectively.
Module service Base-classes and management of ROS services. See L{rospy.tcpros_service} for actual implementation.
Module timer No module docstring; 2/2 classes documented
Module topics rospy implementation of topics.

From __init__.py:

Class AnyMsg Message class to use for subscribing to any topic regardless of type. Incoming messages are not deserialized. Instead, the raw serialized data can be accssed via the buff property.
Class Duration Duration represents the ROS 'duration' primitive type, which consists of two integers: seconds and nanoseconds. The Duration class allows you to add and subtract Duration instances, including adding and subtracting from L{Time} instances.
Class MasterProxy Convenience wrapper for ROS master API and XML-RPC implementation. The Master API methods can be invoked on this object and will be forwarded appropriately. Names in arguments will be remapped according to current node settings...
Class Publisher Class for registering as a publisher of a ROS topic.
Class Rate Convenience class for sleeping in a loop at a specified rate
Class Service Declare a ROS service. Service requests are passed to the specified handler.
Class ServiceProxy Create a handle to a ROS service for invoking calls.
Class SubscribeListener Callback API to receive notifications when new subscribers connect and disconnect.
Class Subscriber Class for registering as a subscriber to a specified topic, where the messages are of a given type.
Class Time Time represents the ROS 'time' primitive type, which consists of two integers: seconds since epoch and nanoseconds since seconds. Time instances are mutable.
Exception ROSException Base exception class for ROS clients
Exception ROSInitException Exception for errors initializing ROS state
Exception ROSInternalException Base class for exceptions that are internal to the ROS system
Exception ROSInterruptException Exception for operations that interrupted, e.g. due to shutdown.
Exception ROSSerializationException Exception for message serialization errors
Exception ServiceException Exception class for service-related errors
Exception TransportException Base class for transport-related exceptions
Exception TransportInitError Internal exception for representing exceptions that occur establishing transports
Exception TransportTerminated Internal class for representing broken connections
Function delete_param Delete a parameter on the param server
Function get_master Get a remote handle to the ROS Master. This method can be called independent of running a ROS node, though the ROS_MASTER_URI must be declared in the environment.
Function get_name Get fully resolved name of local node. If this is not a node, use empty string @return: fully-qualified name of local node or '' if not applicable @rtype: str
Function get_namespace Get namespace of local node. @return: fully-qualified name of local node or '' if not applicable @rtype: str
Function get_node_uri Get this Node's URI. @return: this Node's XMLRPC URI @rtype: str
Function get_param Retrieve a parameter from the param server
Function get_param_cached Retrieve a parameter from the param server with local caching
Function get_param_names Retrieve list of parameter names.
Function get_published_topics Retrieve list of topics that the master is reporting as being published.
Function get_ros_root Get the value of ROS_ROOT. @param env: override environment dictionary @type env: dict @param required: if True, fails with ROSException @return: Value of ROS_ROOT environment @rtype: str @raise ROSException: if require is True and ROS_ROOT is not set...
Function get_rostime Get the current time as a L{Time} object @return: current time as a L{rospy.Time} object @rtype: L{Time}
Function get_time Get the current time as float secs (time.time() format) @return: time in secs (time.time() format) @rtype: float
Function has_param Test if parameter exists on the param server
Function init_node Register client node with the master under the specified name. This MUST be called from the main Python thread unless disable_signals is set to True. Duplicate calls to init_node are only allowed if the arguments are identical as the side-effects of this method are not reversible.
Function is_shutdown @return: True if shutdown flag has been set @rtype: bool
Function logdebug Undocumented
Function logdebug_once Undocumented
Function logdebug_throttle Undocumented
Function logerr Undocumented
Function logerr_once Undocumented
Function logerr_throttle Undocumented
Function logfatal Undocumented
Function logfatal_once Undocumented
Function logfatal_throttle Undocumented
Function loginfo Undocumented
Function loginfo_once Undocumented
Function loginfo_throttle Undocumented
Function logwarn Undocumented
Function logwarn_once Undocumented
Function logwarn_throttle Undocumented
Function myargv Remove ROS remapping arguments from sys.argv arguments. @return: copy of sys.argv with ROS remapping arguments removed @rtype: [str]
Function on_shutdown Register function to be called on shutdown. This function will be called before Node begins teardown. @param h: Function with zero args to be called on shutdown. @type h: fn()
Function parse_rosrpc_uri utility function for parsing ROS-RPC URIs @param uri: ROSRPC URI @type uri: str @return: address, port @rtype: (str, int) @raise ParameterInvalid: if uri is not a valid ROSRPC URI
Function remap_name Remap a ROS name. This API should be used to instead of resolve_name for APIs in which you don't wish to resolve the name unless it is remapped. @param name: name to remap @type name: str
Function resolve_name Resolve a ROS name to its global, canonical form. Private ~names are resolved relative to the node name.
Function search_param Search for a parameter on the param server
Function set_param Set a parameter on the param server
Function signal_shutdown Initiates shutdown process by signaling objects waiting on _shutdown_lock. Shutdown and pre-shutdown hooks are invoked. @param reason: human-readable shutdown reason, if applicable @type reason: str
Function sleep sleep for the specified duration in ROS time. If duration is negative, sleep immediately returns.
Function spin Blocks until ROS node is shutdown. Yields activity to other threads. @raise ROSInitException: if node is not in a properly initialized state
Function wait_for_service Blocks until service is available. Use this in initialization code if your program depends on a service already running. @param service: name of service @type service: str @param timeout: timeout time in seconds or Duration, None for no timeout...
def spin():

Blocks until ROS node is shutdown. Yields activity to other threads. @raise ROSInitException: if node is not in a properly initialized state

def myargv(argv=None):

Remove ROS remapping arguments from sys.argv arguments. @return: copy of sys.argv with ROS remapping arguments removed @rtype: [str]

def init_node(name, argv=None, anonymous=False, log_level=None, disable_rostime=False, disable_rosout=False, disable_signals=False, xmlrpc_port=0, tcpros_port=0):

Register client node with the master under the specified name. This MUST be called from the main Python thread unless disable_signals is set to True. Duplicate calls to init_node are only allowed if the arguments are identical as the side-effects of this method are not reversible.

@param name: Node's name. This parameter must be a base name,
meaning that it cannot contain namespaces (i.e. '/')

@type name: str

@param argv: Command line arguments to this program, including
remapping arguments (default: sys.argv). If you provide argv to init_node(), any previously created rospy data structure (Publisher, Subscriber, Service) will have invalid mappings. It is important that you call init_node() first if you wish to provide your own argv.

@type argv: [str]

@param anonymous: if True, a name will be auto-generated for the
node using name as the base. This is useful when you wish to have multiple instances of the same node and don't care about their actual names (e.g. tools, guis). name will be used as the stem of the auto-generated name. NOTE: you cannot remap the name of an anonymous node.

@type anonymous: bool

@param log_level: log level for sending message to /rosout and log
file, which is INFO by default. For convenience, you may use rospy.DEBUG, rospy.INFO, rospy.ERROR, rospy.WARN, rospy.FATAL

@type log_level: int

@param disable_signals: If True, rospy will not register its own

signal handlers. You must set this flag if (a) you are unable to call init_node from the main thread and/or you are using rospy in an environment where you need to control your own signal handling (e.g. WX). If you set this to True, you should call rospy.signal_shutdown(reason) to initiate clean shutdown.

NOTE: disable_signals is overridden to True if roslib.is_interactive() is True.

@type disable_signals: bool

@param disable_rostime: for internal testing only: suppresses
automatic subscription to rostime

@type disable_rostime: bool

@param disable_rosout: for internal testing only: suppress
auto-publication of rosout

@type disable_rostime: bool

@param xmlrpc_port: If provided, it will use this port number for the client
XMLRPC node.

@type xmlrpc_port: int

@param tcpros_port: If provided, the TCPROS server will listen for
connections on this port

@type tcpros_port: int

@raise ROSInitException: if initialization/registration fails @raise ValueError: if parameters are invalid (e.g. name contains a namespace or is otherwise illegal)

def get_published_topics(namespace='/'):

Retrieve list of topics that the master is reporting as being published.

@return: List of topic names and types: [[topic1, type1]...[topicN, typeN]] @rtype: [[str, str]]

def get_master(env=os.environ):

Get a remote handle to the ROS Master. This method can be called independent of running a ROS node, though the ROS_MASTER_URI must be declared in the environment.

@return: ROS Master remote object @rtype: L{rospy.MasterProxy} @raise Exception: if server cannot be located or system cannot be initialized

def on_shutdown(h):

Register function to be called on shutdown. This function will be called before Node begins teardown. @param h: Function with zero args to be called on shutdown. @type h: fn()

def get_param(param_name, default=_unspecified):

Retrieve a parameter from the param server

NOTE: this method is thread-safe.

@param default: (optional) default value to return if key is not set @type default: any @return: parameter value @rtype: XmlRpcLegalValue @raise ROSException: if parameter server reports an error @raise KeyError: if value not set and default is not given

def get_param_cached(param_name, default=_unspecified):

Retrieve a parameter from the param server with local caching

NOTE: this method is thread-safe.

@param default: (optional) default value to return if key is not set @type default: any @return: parameter value @rtype: XmlRpcLegalValue @raise ROSException: if parameter server reports an error @raise KeyError: if value not set and default is not given

def get_param_names():

Retrieve list of parameter names.

NOTE: this method is thread-safe.

@return: parameter names @rtype: [str] @raise ROSException: if parameter server reports an error

def set_param(param_name, param_value):

Set a parameter on the param server

NOTE: this method is thread-safe. If param_value is a dictionary it will be treated as a parameter tree, where param_name is the namespace. For example::

{'x':1,'y':2,'sub':{'z':3}}

will set param_name/x=1, param_name/y=2, and param_name/sub/z=3. Furthermore, it will replace all existing parameters in the param_name namespace with the parameters in param_value. You must set parameters individually if you wish to perform a union update.

@param param_name: parameter name @type param_name: str @param param_value: parameter value @type param_value: XmlRpcLegalValue @raise ROSException: if parameter server reports an error

def delete_param(param_name):

Delete a parameter on the param server

NOTE: this method is thread-safe.

@param param_name: parameter name @type param_name: str @raise KeyError: if parameter is not set @raise ROSException: if parameter server reports an error

def has_param(param_name):

Test if parameter exists on the param server

NOTE: this method is thread-safe.

@param param_name: parameter name @type param_name: str @raise ROSException: if parameter server reports an error

def search_param(param_name):

Search for a parameter on the param server

NOTE: this method is thread-safe.

@param param_name: parameter name @type param_name: str @return: key of matching parameter or None if no matching parameter. @rtype: str @raise ROSException: if parameter server reports an error

def sleep(duration):

sleep for the specified duration in ROS time. If duration is negative, sleep immediately returns.

@param duration: seconds (or rospy.Duration) to sleep @type duration: float or Duration @raise ROSInterruptException: if ROS shutdown occurs before sleep completes @raise ROSTimeMovedBackwardsException: if ROS time is set backwards

def is_shutdown():

@return: True if shutdown flag has been set @rtype: bool

def signal_shutdown(reason):

Initiates shutdown process by signaling objects waiting on _shutdown_lock. Shutdown and pre-shutdown hooks are invoked. @param reason: human-readable shutdown reason, if applicable @type reason: str

def get_node_uri():

Get this Node's URI. @return: this Node's XMLRPC URI @rtype: str

@deprecated
def get_ros_root(required=False, env=None):

Get the value of ROS_ROOT. @param env: override environment dictionary @type env: dict @param required: if True, fails with ROSException @return: Value of ROS_ROOT environment @rtype: str @raise ROSException: if require is True and ROS_ROOT is not set

def logdebug(msg, *args, **kwargs):

Undocumented

def logwarn(msg, *args, **kwargs):

Undocumented

def loginfo(msg, *args, **kwargs):

Undocumented

def logerr(msg, *args, **kwargs):

Undocumented

def logfatal(msg, *args, **kwargs):

Undocumented

def logdebug_throttle(period, msg, *args, **kwargs):

Undocumented

def logwarn_throttle(period, msg, *args, **kwargs):

Undocumented

def loginfo_throttle(period, msg, *args, **kwargs):

Undocumented

def logerr_throttle(period, msg, *args, **kwargs):

Undocumented

def logfatal_throttle(period, msg, *args, **kwargs):

Undocumented

def logdebug_once(msg, *args, **kwargs):

Undocumented

def logwarn_once(msg, *args, **kwargs):

Undocumented

def loginfo_once(msg, *args, **kwargs):

Undocumented

def logerr_once(msg, *args, **kwargs):

Undocumented

def logfatal_once(msg, *args, **kwargs):

Undocumented

def parse_rosrpc_uri(uri):

utility function for parsing ROS-RPC URIs @param uri: ROSRPC URI @type uri: str @return: address, port @rtype: (str, int) @raise ParameterInvalid: if uri is not a valid ROSRPC URI

def get_name():

Get fully resolved name of local node. If this is not a node, use empty string @return: fully-qualified name of local node or '' if not applicable @rtype: str

def get_namespace():

Get namespace of local node. @return: fully-qualified name of local node or '' if not applicable @rtype: str

def resolve_name(name, caller_id=None):

Resolve a ROS name to its global, canonical form. Private ~names are resolved relative to the node name.

@param name: name to resolve. @type name: str @param caller_id: node name to resolve relative to. To resolve to local namespace, omit this parameter (or use None) @type caller_id: str @return: Resolved name. If name is empty/None, resolve_name returns parent namespace. If namespace is empty/None, @rtype: str

def remap_name(name, caller_id=None, resolved=True):

Remap a ROS name. This API should be used to instead of resolve_name for APIs in which you don't wish to resolve the name unless it is remapped. @param name: name to remap @type name: str

@param resolved: if True (default), use resolved names in remappings, which is the standard for ROS. @type resolved: bool

@return: Remapped name @rtype: str

def get_rostime():

Get the current time as a L{Time} object @return: current time as a L{rospy.Time} object @rtype: L{Time}

def get_time():

Get the current time as float secs (time.time() format) @return: time in secs (time.time() format) @rtype: float

def wait_for_service(service, timeout=None):

Blocks until service is available. Use this in initialization code if your program depends on a service already running. @param service: name of service @type service: str @param timeout: timeout time in seconds or Duration, None for no timeout. NOTE: timeout=0 is invalid as wait_for_service actually contacts the service, so non-blocking behavior is not possible. For timeout=0 uses cases, just call the service without waiting. @type timeout: double|rospy.Duration @note roscpp waitForService() has timeout specified in millisecs. @raise ROSException: if specified timeout is exceeded @raise ROSInterruptException: if shutdown interrupts wait