def start_services(processes): generateWorldFile.main(config) FNULL = open(devnull, 'w') processes.append( subprocess.Popen(['roscore'], shell=False, stdout=FNULL, stderr=error_log))
def main(argv): testing = False debugging = False webservice = False # Loads the config properties and passes the dictionary to the generate scripts config = {} with open("config.properties", "r") as f: for line in f: property = line.split('=') config[property[0]] = property[1] # Checks if any arguments has been given try: opts, args = getopt.getopt(argv, "dtw") except getopt.GetoptError: print 'run.py -d for debugger mode ' print 'run.py -t for testing mode ' print 'run.py -w for webservice mode ' sys.exit(2) for opt, arg in opts: if opt == "-t": testing = True elif opt == "-d": debugging = True elif opt == "-w": webservice = True if testing: list = generateEntity.main(['-t'], config) generateWorldFile.main(config) return list else: if debugging: list = generateEntity.main(["-d"]) else: list = generateEntity.main([""], config) atexit.register(generateEntity.exit_process, list) generateWorldFile.main(config) processes.append(subprocess.Popen(["roscore"], shell=False)) processes.append( subprocess.Popen( ["rosrun", "stage_ros", "stageros", "world/myworld.world"], shell=False)) time.sleep(5) atexit.register(kill_process) # Executes GUI script processes.append( subprocess.Popen(['python', 'GUI_overlay.py'], cwd=r'./se306Project1/src')) atexit.register(delete_guifiles) if webservice: processes.append( subprocess.Popen(['python', 'Webservice.py'], cwd=r'./se306Project1/src')) while True: pass
def main(argv): testing = False debugging = False webservice = False # Loads the config properties and passes the dictionary to the generate scripts config = {} with open("config.properties", "r") as f: for line in f: property = line.split('=') config[property[0]] = property[1] # Checks if any arguments has been given try: opts, args = getopt.getopt(argv,"dtw") except getopt.GetoptError: print 'run.py -d for debugger mode ' print 'run.py -t for testing mode ' print 'run.py -w for webservice mode ' sys.exit(2) for opt, arg in opts: if opt == "-t": testing = True elif opt == "-d": debugging = True elif opt == "-w": webservice = True if testing: list = generateEntity.main(['-t'], config) generateWorldFile.main(config) return list else: if debugging: list = generateEntity.main(["-d"]) else: list = generateEntity.main([""], config) atexit.register(generateEntity.exit_process, list) generateWorldFile.main(config) processes.append(subprocess.Popen(["roscore"], shell=False)) processes.append(subprocess.Popen(["rosrun", "stage_ros", "stageros", "world/myworld.world"], shell=False)) time.sleep(5) atexit.register(kill_process) # Executes GUI script processes.append(subprocess.Popen(['python', 'GUI_overlay.py'], cwd=r'./se306Project1/src')) atexit.register(delete_guifiles) if webservice: processes.append(subprocess.Popen(['python', 'Webservice.py'], cwd=r'./se306Project1/src')) while True: pass
def start_services(processes): generateWorldFile.main(config) FNULL = open(devnull, 'w') processes.append(subprocess.Popen(['roscore'], shell=False, stdout=FNULL, stderr=error_log))