2Stand-ins for `rospy.names` in ROS2.
4------------------------------------------------------------------------------
5This file is part of rosros - simple unified interface to ROS1 / ROS2.
6Released under the BSD License.
11------------------------------------------------------------------------------
13## @namespace rosros.rospify.names
18 """Returns fully resolved name of local node."""
19 return ros2.get_node_name()
if ros2.NODE
else "/unnamed"
23get_caller_id = get_name
27 """Returns namespace of local node."""
28 return ros2.NODE.get_namespace()
if ros2.NODE
else "/"
31def remap_name(name, caller_id=None, resolved=True):
33 Returns a remapped topic/service name.
35 @param name name to remap
36 @param caller_id namespace to resolve a relative
or private name under,
37 by default current node namespace
38 @param resolved ignored (does nothing
in ROS1 also)
39 @return remapped name resolved to namespace,
or original
if not mapped
41 return ros2.remap_name(name, caller_id)
44def resolve_name(name, caller_id=None):
46 Resolve a ROS name to its global, canonical form.
48 Private ~names are resolved relative to the node name.
50 @param name name to resolve.
51 @param caller_id node name to resolve relative to.
52 To resolve to local namespace, omit this parameter (
or use
None)
53 @return Resolved name. If name
is empty/
None, resolve_name
54 returns parent namespace.
57 return ros2.resolve_name(name, caller_id)
61 "get_caller_id",
"get_name",
"get_namespace",
"remap_name",
"resolve_name"
get_namespace()
Returns namespace of local node.