module documentation

Library for manipulating ROS Names. See U{http://ros.org/wiki/Names}.

Function anonymous_name Generate a ROS-legal 'anonymous' name
Function canonicalize_name Put name in canonical form. Extra slashes '//' are removed and name is returned without any trailing slash, e.g. /foo/bar @param name: ROS name @type name: str
Function get_ros_namespace @param env: environment dictionary (defaults to os.environ) @type env: dict @param argv: command-line arguments (defaults to sys.argv) @type argv: [str] @return: ROS namespace of current program @rtype: str...
Function is_global Test if name is a global graph resource name.
Function is_legal_base_name Validates that name is a legal base name for a graph resource. A base name has no namespace context, e.g. "node_name".
Function is_legal_name Check if name is a legal ROS name for graph resources (alphabetical character followed by alphanumeric, underscore, or forward slashes). This constraint is currently not being enforced, but may start getting enforced in later versions of ROS.
Function is_legal_remap Validates that arg is a legal remap according to U{http://wiki.ros.org/Remapping%20Arguments}.
Function is_private Test if name is a private graph resource name.
Function isstring Undocumented
Function load_mappings Load name mappings encoded in command-line arguments. This will filter out any parameter assignment mappings.
Function make_caller_id Resolve a local name to the caller ID based on ROS environment settings (i.e. ROS_NAMESPACE)
Function make_global_ns Convert name to a global name with a trailing namespace separator.
Function namespace Get the namespace of name. The namespace is returned with a trailing slash in order to favor easy concatenation and easier use within the global context.
Function ns_join Join a namespace and name. If name is unjoinable (i.e. ~private or /global) it will be returned without joining
Function resolve_name Resolve a ROS name to its global, canonical form. Private ~names are resolved relative to the node name.
Function script_resolve_name Name resolver for scripts. Supports :envvar:`ROS_NAMESPACE`. Does not support remapping arguments.
Constant ANYTYPE Undocumented
Constant BASE_NAME_LEGAL_CHARS_P Undocumented
Constant GLOBALNS Undocumented
Constant MSG_EXT Undocumented
Constant NAME_LEGAL_CHARS_P Undocumented
Constant PRIV_NAME Undocumented
Constant REMAP Undocumented
Constant REMAP_PATTERN Undocumented
Constant SEP Undocumented
Constant SRV_EXT Undocumented
def anonymous_name(id):

Generate a ROS-legal 'anonymous' name

@param id: prefix for anonymous name @type id: str

def canonicalize_name(name):

Put name in canonical form. Extra slashes '//' are removed and name is returned without any trailing slash, e.g. /foo/bar @param name: ROS name @type name: str

def get_ros_namespace(env=None, argv=None):

@param env: environment dictionary (defaults to os.environ) @type env: dict @param argv: command-line arguments (defaults to sys.argv) @type argv: [str] @return: ROS namespace of current program @rtype: str

def is_global(name):

Test if name is a global graph resource name.

@param name: must be a legal name in canonical form @type name: str @return: True if name is a globally referenced name (i.e. /ns/name) @rtype: bool

def is_legal_base_name(name):

Validates that name is a legal base name for a graph resource. A base name has no namespace context, e.g. "node_name".

def is_legal_name(name):

Check if name is a legal ROS name for graph resources (alphabetical character followed by alphanumeric, underscore, or forward slashes). This constraint is currently not being enforced, but may start getting enforced in later versions of ROS.

@param name: Name @type name: str

def is_legal_remap(arg):

Validates that arg is a legal remap according to U{http://wiki.ros.org/Remapping%20Arguments}.

def is_private(name):

Test if name is a private graph resource name.

@param name: must be a legal name in canonical form @type name: str @return bool: True if name is a privately referenced name (i.e. ~name)

def isstring(s):

Undocumented

def load_mappings(argv):

Load name mappings encoded in command-line arguments. This will filter out any parameter assignment mappings.

@param argv: command-line arguments @type argv: [str] @return: name->name remappings. @rtype: dict {str: str}

def make_caller_id(name):

Resolve a local name to the caller ID based on ROS environment settings (i.e. ROS_NAMESPACE)

@param name: local name to calculate caller ID from, e.g. 'camera', 'node' @type name: str @return: caller ID based on supplied local name @rtype: str

def make_global_ns(name):

Convert name to a global name with a trailing namespace separator.

@param name: ROS resource name. Cannot be a ~name. @type name: str @return str: name as a global name, e.g. 'foo' -> '/foo/'.

This does NOT resolve a name.

@rtype: str @raise ValueError: if name is a ~name

def namespace(name):

Get the namespace of name. The namespace is returned with a trailing slash in order to favor easy concatenation and easier use within the global context.

@param name: name to return the namespace of. Must be a legal
name. NOTE: an empty name will return the global namespace.

@type name: str @return str: Namespace of name. For example, '/wg/node1' returns '/wg/'. The

global namespace is '/'.

@rtype: str @raise ValueError: if name is invalid

def ns_join(ns, name):

Join a namespace and name. If name is unjoinable (i.e. ~private or /global) it will be returned without joining

@param ns: namespace ('/' and '~' are both legal). If ns is the empty string, name will be returned. @type ns: str @param name str: a legal name @return str: name concatenated to ns, or name if it is

unjoinable.

@rtype: str

def resolve_name(name, namespace_, remappings=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 namespace_: node name to resolve relative to. @type namespace_: str @param remappings: Map of resolved remappings. Use None to indicate no remapping. @return: Resolved name. If name is empty/None, resolve_name returns parent namespace_. If namespace_ is empty/None, @rtype: str

def script_resolve_name(script_name, name):

Name resolver for scripts. Supports :envvar:`ROS_NAMESPACE`. Does not support remapping arguments.

Parameters
script_namename of script. script_name must not contain a namespace., str
namename to resolve, str
Returns
resolved name, str
ANYTYPE: str =

Undocumented

Value
'*'
BASE_NAME_LEGAL_CHARS_P =

Undocumented

Value
re.compile(r'^[A-Za-z]\w*$')
GLOBALNS: str =

Undocumented

Value
'/'
MSG_EXT: str =

Undocumented

Value
'.msg'
NAME_LEGAL_CHARS_P =

Undocumented

Value
re.compile(r'^[~/A-Za-z][\w/]*$')
PRIV_NAME: str =

Undocumented

Value
'~'
REMAP: str =

Undocumented

Value
':='
REMAP_PATTERN =

Undocumented

Value
re.compile(('^([\\~\\/A-Za-z]|_|__)[\\w\\/]*'+REMAP+'.*'))
SEP: str =

Undocumented

Value
'/'
SRV_EXT: str =

Undocumented

Value
'.srv'