Package rospy :: Module names

Module names

source code

Support for ROS Names

See: http://www.ros.org/wiki/Names

Functions
 
canonicalize_name(name)
Put name in canonical form.
source code
 
reload_mappings(argv)
Re-initialize the name remapping table.
source code
 
initialize_mappings(node_name)
Initialize the remapping table based on provide node name.
source code
 
resolve_name_without_node_name(name)
The need for this function is complicated -- Topics and Services can be created before init_node is called.
source code
{str: str}
get_mappings()
Get mapping table with unresolved names
source code
{str: str}
get_resolved_mappings()
Get mapping table with resolved names
source code
str
resolve_name(name, caller_id=None)
Resolve a ROS name to its global, canonical form.
source code
str
remap_name(name, caller_id=None, resolved=True)
Remap a ROS name.
source code
str
scoped_name(caller_id, name)
Convert the global caller_id to a relative name within the namespace.
source code
 
valid_name_validator_resolved(param_name, param_value, caller_id) source code
 
valid_name_validator_unresolved(param_name, param_value, caller_id) source code
str
valid_name(param_name, resolve=True)
Validator that resolves names and also ensures that they are not empty
source code
str
global_name(param_name)
Validator that checks for valid, global graph resource name.
source code
str
get_namespace()
Get namespace of local node.
source code
str
get_name()
Get fully resolved name of local node.
source code
str
get_caller_id()
Get fully resolved name of local node.
source code
Variables
  TOPIC_ANYTYPE = '*'
  SERVICE_ANYTYPE = '*'
  __package__ = 'rospy'
Function Details

canonicalize_name(name)

source code 

Put name in canonical form. Double slashes '//' are removed and name is returned without any trailing slash, e.g. /foo/bar

Parameters:
  • name (str) - ROS name

reload_mappings(argv)

source code 

Re-initialize the name remapping table.

Parameters:
  • argv ([str]) - Command line arguments to this program. ROS reads these arguments to find renaming params.

initialize_mappings(node_name)

source code 

Initialize the remapping table based on provide node name.

Parameters:
  • node_name (str) - name of node (caller ID)

resolve_name_without_node_name(name)

source code 

The need for this function is complicated -- Topics and Services can be created before init_node is called. In general, this is okay, unless the name is a ~name, in which case we have to raise an ValueError

Parameters:
  • name (str) - ROS name to resolve
Raises:
  • ValueError - if name is a ~name
  • ROSInitException - if name is remapped to a ~name

get_mappings()

source code 

Get mapping table with unresolved names

Returns: {str: str}
command-line remappings {name: name}

get_resolved_mappings()

source code 

Get mapping table with resolved names

Returns: {str: str}
command-line remappings {name: name}

resolve_name(name, caller_id=None)

source code 

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

Parameters:
  • name (str) - name to resolve.
  • caller_id (str) - node name to resolve relative to. To resolve to local namespace, omit this parameter (or use None)
Returns: str
Resolved name. If name is empty/None, resolve_name returns parent namespace. If namespace is empty/None,

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

source code 

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.

Parameters:
  • name (str) - name to remap
  • resolved (bool) - if True (default), use resolved names in remappings, which is the standard for ROS.
Returns: str
Remapped name

scoped_name(caller_id, name)

source code 

Convert the global caller_id to a relative name within the namespace. For example, for namespace '/foo' and name '/foo/bar/name', the return value will be 'bar/name'

WARNING: scoped_name does not validate that name is actually within the supplied namespace.

Parameters:
  • caller_id (str) - caller ID, in canonical form
  • name (str) - name to scope
Returns: str
name scoped to the caller_id's namespace.

valid_name(param_name, resolve=True)

source code 

Validator that resolves names and also ensures that they are not empty

Parameters:
  • param_name (str) - name
  • resolve (bool) - if True/omitted, the name will be resolved to a global form. Otherwise, no resolution occurs.
Returns: str
resolved parameter value

global_name(param_name)

source code 

Validator that checks for valid, global graph resource name.

Returns: str
parameter value

get_namespace()

source code 

Get namespace of local node.

Returns: str
fully-qualified name of local node or '' if not applicable

get_name()

source code 

Get fully resolved name of local node. If this is not a node, use empty string

Returns: str
fully-qualified name of local node or '' if not applicable

get_caller_id()

source code 

Get fully resolved name of local node. If this is not a node, use empty string

Returns: str
fully-qualified name of local node or '' if not applicable