def init_main_window(prog_name, masteruri, launch_files=[]): ''' Intialize the environment to start Node Manager. ''' # 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 err: print("Error while set the log level: %s\n->INFO level will be used!" % err) log_level = rospy.INFO rospy.init_node(prog_name, anonymous=False, log_level=log_level) set_terminal_name(prog_name) set_process_name(prog_name) from node_manager_fkie.main_window import MainWindow local_master = init_globals(masteruri) return MainWindow(launch_files, not local_master, launch_files)
def init_main_window(prog_name, masteruri, launch_files=[]): ''' Intialize the environment to start Node Manager. ''' # 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 err: print "Error while set the log level: %s\n->INFO level will be used!" % err log_level = rospy.INFO rospy.init_node(prog_name, anonymous=False, log_level=log_level) set_terminal_name(prog_name) set_process_name(prog_name) from node_manager_fkie.main_window import MainWindow local_master = init_globals(masteruri) return MainWindow(launch_files, not local_master, launch_files)
def init_globals(masteruri): ''' :return: True if the masteruri referred to localhost :rtype: bool ''' # 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(get_hostname(masteruri)) # fill cache