def init_echo_dialog(prog_name, masteruri, topic_name, topic_type, hz=False): # start ROS-Master, if not currently running StartHandler._prepareROSMaster(masteruri) name = ''.join([prog_name, '_echo']) rospy.init_node(name, anonymous=True, log_level=rospy.DEBUG) setTerminalName(rospy.get_name()) setProcessName(rospy.get_name()) import echo_dialog return echo_dialog.EchoDialog(topic_name, topic_type, hz, masteruri)
def init_main_window(prog_name, masteruri, launch_files=[]): # start ROS-Master, if not currently running StartHandler._prepareROSMaster(masteruri) rospy.init_node(prog_name, anonymous=False, log_level=rospy.DEBUG) setTerminalName(rospy.get_name()) setProcessName(rospy.get_name()) import main_window local_master = init_globals(masteruri) return main_window.MainWindow(launch_files, not local_master, launch_files)
def init_echo_dialog(prog_name, masteruri, topic_name, topic_type, hz=False, use_ssh=False): # start ROS-Master, if not currently running StartHandler._prepareROSMaster(masteruri) name = ''.join([prog_name, '_echo']) rospy.init_node(name, anonymous=True, log_level=rospy.INFO) setTerminalName(name) setProcessName(name) import echo_dialog global _ssh_handler _ssh_handler = SSHhandler() return echo_dialog.EchoDialog(topic_name, topic_type, hz, masteruri, use_ssh=use_ssh)
def init_cfg_path(): global CFG_PATH masteruri = masteruri_from_ros() CFG_PATH = ''.join([get_ros_home(), os.sep, 'node_manager', os.sep]) ''' Creates and runs the ROS node. ''' if not os.path.isdir(CFG_PATH): os.makedirs(CFG_PATH) # start ROS-Master, if not currently running StartHandler._prepareROSMaster(masteruri) return masteruri
def init_main_window(prog_name, masteruri, launch_files=[]): # start ROS-Master, if not currently running StartHandler._prepareROSMaster(masteruri) # setup the loglevel try: log_level = getattr(rospy, rospy.get_param('/%s/log_level'%prog_name, "INFO")) except Exception as e: print "Error while set the log level: %s\n->INFO level will be used!"%e log_level = rospy.INFO rospy.init_node(prog_name, anonymous=False, log_level=log_level) setTerminalName(prog_name) setProcessName(prog_name) import main_window local_master = init_globals(masteruri) return main_window.MainWindow(launch_files, not local_master, launch_files)
def init_globals(masteruri): # initialize the global handler global _ssh_handler global _screen_handler global _start_handler global _name_resolution global _history global _file_watcher global _file_watcher_param _ssh_handler = SSHhandler() _screen_handler = ScreenHandler() _start_handler = StartHandler() _name_resolution = NameResolution() _history = History() _file_watcher = FileWatcher() _file_watcher_param = FileWatcher() # test where the roscore is running (local or remote) __is_local('localhost') ## fill cache return __is_local(_name_resolution.getHostname(masteruri)) ## fill cache
def main(): ''' Creates and runs the ROS node. ''' setTerminalName(NODE_NAME) setProcessName(NODE_NAME) try: from PySide.QtGui import QApplication from PySide.QtCore import QTimer except: print >> sys.stderr, "please install 'python-pyside' package!!" sys.exit(-1) rospy.init_node(NODE_NAME, log_level=rospy.DEBUG) # Initialize Qt global app app = QApplication(sys.argv) # initialize the global handler global _ssh_handler global _screen_handler global _start_handler global _name_resolution _ssh_handler = SSHhandler() _screen_handler = ScreenHandler() _start_handler = StartHandler() _name_resolution = NameResolution() #start the gui import main_window mainForm = main_window.MainWindow() if not rospy.is_shutdown(): mainForm.show() exit_code = -1 try: rospy.on_shutdown(finish) exit_code = app.exec_() mainForm.finish() finally: sys.exit(exit_code)
def main(name, anonymous=False): global CFG_PATH masteruri = masteruri_from_ros() CFG_PATH = ''.join([get_ros_home(), os.sep, 'node_manager', os.sep]) ''' Creates and runs the ROS node. ''' if not os.path.isdir(CFG_PATH): os.makedirs(CFG_PATH) args = rospy.myargv(argv=sys.argv) # decide to show main or echo dialog if len(args) >= 4 and args[1] == '-t': name = ''.join([name, '_echo']) anonymous = True try: from PySide.QtGui import QApplication except: print >> sys.stderr, "please install 'python-pyside' package!!" sys.exit(-1) # start ROS-Master, if not currently running StartHandler._prepareROSMaster(masteruri) rospy.init_node(name, anonymous=anonymous, log_level=rospy.DEBUG) setTerminalName(rospy.get_name()) setProcessName(rospy.get_name()) # Initialize Qt global app app = QApplication(sys.argv) # decide to show main or echo dialog import main_window, echo_dialog global main_form if len(args) >= 4 and args[1] == '-t': show_hz_only = (len(args) > 4 and args[4] == '--hz') main_form = echo_dialog.EchoDialog(args[2], args[3], show_hz_only) else: # initialize the global handler global _ssh_handler global _screen_handler global _start_handler global _name_resolution global _history _ssh_handler = SSHhandler() _screen_handler = ScreenHandler() _start_handler = StartHandler() _name_resolution = NameResolution() _history = History() # test where the roscore is running (local or remote) __is_local('localhost') ## fill cache __is_local(_name_resolution.getHostname(masteruri)) ## fill cache local_master = is_local(_name_resolution.getHostname(masteruri)) #start the gui main_form = main_window.MainWindow(args, not local_master) if not rospy.is_shutdown(): os.chdir(PACKAGE_DIR ) # change path to be able to the images of descriptions main_form.show() exit_code = -1 rospy.on_shutdown(finish) exit_code = app.exec_()
def main(name, anonymous=False): global CFG_PATH masteruri = masteruri_from_ros() CFG_PATH = ''.join([get_ros_home(), os.sep, 'node_manager', os.sep]) ''' Creates and runs the ROS node. ''' if not os.path.isdir(CFG_PATH): os.makedirs(CFG_PATH) args = rospy.myargv(argv=sys.argv) # decide to show main or echo dialog if len(args) >= 4 and args[1] == '-t': name = ''.join([name, '_echo']) anonymous = True try: from PySide.QtGui import QApplication except: print >> sys.stderr, "please install 'python-pyside' package!!" sys.exit(-1) # start ROS-Master, if not currently running StartHandler._prepareROSMaster(masteruri) rospy.init_node(name, anonymous=anonymous, log_level=rospy.DEBUG) setTerminalName(rospy.get_name()) setProcessName(rospy.get_name()) # Initialize Qt global app app = QApplication(sys.argv) # decide to show main or echo dialog import main_window, echo_dialog global main_form if len(args) >= 4 and args[1] == '-t': show_hz_only = (len(args) > 4 and args[4] == '--hz') main_form = echo_dialog.EchoDialog(args[2], args[3], show_hz_only) else: # initialize the global handler global _ssh_handler global _screen_handler global _start_handler global _name_resolution global _history _ssh_handler = SSHhandler() _screen_handler = ScreenHandler() _start_handler = StartHandler() _name_resolution = NameResolution() _history = History() # test where the roscore is running (local or remote) __is_local('localhost') ## fill cache __is_local(_name_resolution.getHostname(masteruri)) ## fill cache local_master = is_local(_name_resolution.getHostname(masteruri)) #start the gui main_form = main_window.MainWindow(args, not local_master) if not rospy.is_shutdown(): os.chdir(PACKAGE_DIR) # change path to be able to the images of descriptions main_form.show() exit_code = -1 rospy.on_shutdown(finish) exit_code = app.exec_()