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 from __future__ import print_function 35 36 import sys 37 38 import roslib 39 import rospy 40 41 from . import master_sync 42 43 PROCESS_NAME = "master_sync" 44 4547 ''' 48 Change the terminal name. 49 @param name: New name of the terminal 50 @type name: C{str} 51 ''' 52 sys.stdout.write("\x1b]2;%s\x07" % name)53 5456 ''' 57 Change the process name. 58 @param name: New process name 59 @type name: C{str} 60 ''' 61 try: 62 from ctypes import cdll, byref, create_string_buffer 63 libc = cdll.LoadLibrary('libc.so.6') 64 buff = create_string_buffer(len(name) + 1) 65 buff.value = name 66 libc.prctl(15, byref(buff), 0, 0, 0) 67 except: 68 pass69 7072 ''' 73 Creates and runs the ROS node. 74 ''' 75 # setup the loglevel 76 try: 77 log_level = getattr(rospy, rospy.get_param('/%s/log_level' % PROCESS_NAME, "INFO")) 78 except Exception as e: 79 print("Error while set the log level: %s\n->INFO level will be used!" % e) 80 log_level = rospy.INFO 81 rospy.init_node(PROCESS_NAME, log_level=log_level) 82 set_terminal_name(PROCESS_NAME) 83 set_process_name(PROCESS_NAME) 84 # time to initialize the topics to receive these in rxconsole 85 discoverer = master_sync.Main() 86 if not rospy.is_shutdown(): 87 rospy.spin()88
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Tue Mar 1 06:56:05 2022 | http://epydoc.sourceforge.net |