コード例 #1
0
def get_test_sets(scenario):

	load_params(SCENARIOS_PATH+"normal.yaml")
	time.sleep(5)  # give time to return in normal mode
	
	exp_path = EXPERIMENTS_PATH + scenario + "_" + str(datetime.datetime.time(datetime.datetime.now()))+"/"	
	os.mkdir(exp_path)

	scenario = scenario + ".yaml"
	experiment_params = [
				{"name":"/sampling_time", "value":"0.5"}, 
				{"name":"/duration", "value":str(DURATION)}, 
				{"name":"/logs","value": '"'+exp_path+'"'}, 
				{"name":"/normal","value":str(NORMAL)}, 
				{"name":"/faulty","value": str(FAULTY)}
			]
	file_creator.create_yaml_file(experiment_params, exp_path, 'experiment.yaml', '/experiment/')
	load_params(exp_path+'experiment.yaml') # creates parameters yaml file and load it in parameter server
	shutil.copy(SCENARIOS_PATH+"normal.yaml",exp_path+"normal.yaml")
	
	if os.path.isfile(SCENARIOS_PATH+scenario) == False:
		print 'UNABLE TO LOCATE "%s"' % scenario
		sys.exit()
	
	args = [SCENARIOS_PATH+"normal.yaml", SCENARIOS_PATH+scenario, 0]
	
	
	shutil.copy(SCENARIOS_PATH+scenario,exp_path+scenario)
	thread.start_new_thread(faulty_simulator,(args,))
	
	subprocess.call("rosrun anomaly_detection experiment_manip_main.py",shell=True) # blocks until experiment completes

	load_params(SCENARIOS_PATH+"normal.yaml")
	time.sleep(10)
コード例 #2
0
def get_train_set():
	
		load_params(SCENARIOS_PATH+"normal.yaml")
		time.sleep(5)  # give time to return in normal mode
		exp_path = EXPERIMENTS_PATH + "exp_train_" + str(datetime.datetime.time(datetime.datetime.now()))+"/"
		os.mkdir(exp_path)
		experiment_params = [
				{"name":"/sampling_time", "value":"0.5"}, 
				{"name":"/duration", "value":str(DURATION)}, 
				{"name":"/logs","value": '"'+exp_path+'"'}, 
				{"name":"/normal","value":str(NORMAL)}, 
				{"name":"/faulty","value": str(FAULTY)}
			]
		shutil.copy(SCENARIOS_PATH+"normal.yaml",exp_path+"normal.yaml")
		file_creator.create_yaml_file(experiment_params, exp_path, 'experiment.yaml', "/experiment/")
		
		load_params(exp_path+'experiment.yaml')
		run_experiment()
		time.sleep(5)