Home | Trees | Indices | Help |
|
---|
|
1 # Software License Agreement (BSD License) 2 # 3 # Copyright (c) 2008, Willow Garage, Inc. 4 # All rights reserved. 5 # 6 # Redistribution and use in source and binary forms, with or without 7 # modification, are permitted provided that the following conditions 8 # are met: 9 # 10 # * Redistributions of source code must retain the above copyright 11 # notice, this list of conditions and the following disclaimer. 12 # * Redistributions in binary form must reproduce the above 13 # copyright notice, this list of conditions and the following 14 # disclaimer in the documentation and/or other materials provided 15 # with the distribution. 16 # * Neither the name of Willow Garage, Inc. nor the names of its 17 # contributors may be used to endorse or promote products derived 18 # from this software without specific prior written permission. 19 # 20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 # POSSIBILITY OF SUCH DAMAGE. 32 # 33 # Revision $Id$ 34 # $Author$ 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 warnings 44 45 import roslib.names 46 47 # caller ID for master calls where caller ID is not vital 48 _GLOBAL_CALLER_ID = '/script'52 """This is a decorator which can be used to mark functions 53 as deprecated. It will result in a warning being emmitted 54 when the function is used.""" 55 def newFunc(*args, **kwargs): 56 warnings.warn('Call to deprecated function %s.' % func.__name__, 57 category=DeprecationWarning, stacklevel=2) 58 return func(*args, **kwargs)59 newFunc.__name__ = func.__name__ 60 newFunc.__doc__ = func.__doc__ 61 newFunc.__dict__.update(func.__dict__) 62 return newFunc 6367 """ 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: # empty string resolves to namespace 79 return roslib.names.get_ros_namespace() 80 # Check for global name: /foo/name resolves to /foo/name 81 if roslib.names.is_global(name): 82 return name 83 # Check for private name: ~name resolves to /caller_id/name 84 elif roslib.names.is_private(name): 85 return roslib.names.ns_join(roslib.names.make_caller_id(script_name), name[1:]) 86 return roslib.names.get_ros_namespace() + name8791 """ 92 Get an XMLRPC handle to the Master. It is recommended to use the 93 `rosgraph.masterapi` library instead, as it provides many 94 conveniences. 95 96 @return: XML-RPC proxy to ROS master 97 @rtype: xmlrpclib.ServerProxy 98 @raises ValueError if master URI is invalid 99 """ 100 try: 101 import xmlrpc.client as xmlrpcclient # Python 3.x 102 except ImportError: 103 import xmlrpclib as xmlrpcclient # Python 2.x 104 105 # changed this to not look as sys args and remove dependency on roslib.rosenv for cleaner cleanup 106 uri = os.environ['ROS_MASTER_URI'] 107 return xmlrpcclient.ServerProxy(uri)108112 """ 113 @return: ServerProxy XML-RPC proxy to ROS parameter server 114 @rtype: xmlrpclib.ServerProxy 115 """ 116 return get_master()117
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Mar 1 07:28:11 2022 | http://epydoc.sourceforge.net |