1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 """
37 Warning: do not use this library. It is unstable and most of the routines
38 here have been superceded by other libraries (e.g. rospkg). These
39 routines will likely be *deleted* in future releases.
40 """
41
42 import os
43 import sys
44
45 import roslib.names
46
47
48 _GLOBAL_CALLER_ID = '/script'
49
50
51 import warnings
53 """This is a decorator which can be used to mark functions
54 as deprecated. It will result in a warning being emmitted
55 when the function is used."""
56 def newFunc(*args, **kwargs):
57 warnings.warn("Call to deprecated function %s." % func.__name__,
58 category=DeprecationWarning, stacklevel=2)
59 return func(*args, **kwargs)
60 newFunc.__name__ = func.__name__
61 newFunc.__doc__ = func.__doc__
62 newFunc.__dict__.update(func.__dict__)
63 return newFunc
64
67 """
68 Name resolver for scripts. Supports ROS_NAMESPACE. Does not
69 support remapping arguments.
70 @param name: name to resolve
71 @type name: str
72 @param script_name: name of script. script_name must not
73 contain a namespace.
74 @type script_name: str
75 @return: resolved name
76 @rtype: str
77 """
78 if not name:
79 return roslib.names.get_ros_namespace()
80
81 if roslib.names.is_global(name):
82 return name
83
84 elif roslib.names.is_private(name):
85 return ns_join(roslib.names.make_caller_id(script_name), name[1:])
86 return roslib.names.get_ros_namespace() + name
87
90 """
91 Get an XMLRPC handle to the Master. It is recommended to use the
92 `rosgraph.masterapi` library instead, as it provides many
93 conveniences.
94
95 @return: XML-RPC proxy to ROS master
96 @rtype: xmlrpclib.ServerProxy
97 @raises ValueError if master URI is invalid
98 """
99 try:
100 import xmlrpc.client as xmlrpcclient
101 except ImportError:
102 import xmlrpclib as xmlrpcclient
103
104
105 uri = os.environ['ROS_MASTER_URI']
106 return xmlrpcclient.ServerProxy(uri)
107
110 """
111 @return: ServerProxy XML-RPC proxy to ROS parameter server
112 @rtype: xmlrpclib.ServerProxy
113 """
114 return get_master()
115