Home | Trees | Indices | Help |
---|
|
1 #!/usr/bin/env python 2 # Software License Agreement (BSD License) 3 # 4 # Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko 5 # All rights reserved. 6 # 7 # Redistribution and use in source and binary forms, with or without 8 # modification, are permitted provided that the following conditions 9 # are met: 10 # 11 # * Redistributions of source code must retain the above copyright 12 # notice, this list of conditions and the following disclaimer. 13 # * Redistributions in binary form must reproduce the above 14 # copyright notice, this list of conditions and the following 15 # disclaimer in the documentation and/or other materials provided 16 # with the distribution. 17 # * Neither the name of Fraunhofer nor the names of its 18 # contributors may be used to endorse or promote products derived 19 # from this software without specific prior written permission. 20 # 21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 # POSSIBILITY OF SUCH DAMAGE. 33 34 import sys 35 36 import roslib 37 import rospy 38 39 import master_sync 40 41 PROCESS_NAME = "master_sync" 42 4345 ''' 46 Change the terminal name. 47 @param name: New name of the terminal 48 @type name: C{str} 49 ''' 50 sys.stdout.write("\x1b]2;%s\x07" % name)51 5254 ''' 55 Change the process name. 56 @param name: New process name 57 @type name: C{str} 58 ''' 59 try: 60 from ctypes import cdll, byref, create_string_buffer 61 libc = cdll.LoadLibrary('libc.so.6') 62 buff = create_string_buffer(len(name) + 1) 63 buff.value = name 64 libc.prctl(15, byref(buff), 0, 0, 0) 65 except: 66 pass67 6870 ''' 71 Creates and runs the ROS node. 72 ''' 73 # setup the loglevel 74 try: 75 log_level = getattr(rospy, rospy.get_param('/%s/log_level' % PROCESS_NAME, "INFO")) 76 except Exception as e: 77 print "Error while set the log level: %s\n->INFO level will be used!" % e 78 log_level = rospy.INFO 79 rospy.init_node(PROCESS_NAME, log_level=log_level) 80 set_terminal_name(PROCESS_NAME) 81 set_process_name(PROCESS_NAME) 82 # time to initialize the topics to receive these in rxconsole 83 discoverer = master_sync.Main() 84 if not rospy.is_shutdown(): 85 rospy.spin()86
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri May 3 02:27:52 2019 | http://epydoc.sourceforge.net |