|  |  | @ -0,0 +1,37 @@ | 
			
		
	
		
			
				
					|  |  |  | import gym | 
			
		
	
		
			
				
					|  |  |  | from gym_minigrid.wrappers import RGBImgObsWrapper, ImgObsWrapper, MiniWrapper | 
			
		
	
		
			
				
					|  |  |  | from subprocess import call | 
			
		
	
		
			
				
					|  |  |  | from os import listdir, system | 
			
		
	
		
			
				
					|  |  |  | from os.path import isfile, join, getctime | 
			
		
	
		
			
				
					|  |  |  | import argparse | 
			
		
	
		
			
				
					|  |  |  | from gym_minigrid.policyRepairEnv import State | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | def main(): | 
			
		
	
		
			
				
					|  |  |  |     LOG("> Start Application ...") | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     ################################################################# | 
			
		
	
		
			
				
					|  |  |  |     # Parse command line arguments | 
			
		
	
		
			
				
					|  |  |  |     parser = argparse.ArgumentParser() | 
			
		
	
		
			
				
					|  |  |  |     parser.add_argument('--env', type=str, required=True, help='Environment (for now only "Testing-v0" possible)') | 
			
		
	
		
			
				
					|  |  |  |     args = parser.parse_args() | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     ################################################################ | 
			
		
	
		
			
				
					|  |  |  |     # Create & Setup environment | 
			
		
	
		
			
				
					|  |  |  |     env = gym.make(args.env, render_mode="human") | 
			
		
	
		
			
				
					|  |  |  |     env = RGBImgObsWrapper(env) # Get pixel observations | 
			
		
	
		
			
				
					|  |  |  |     env = ImgObsWrapper(env)    # Get rid of the 'mission' field | 
			
		
	
		
			
				
					|  |  |  |     env = MiniWrapper(env)      # Project specific changes | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     observation = env.reset() | 
			
		
	
		
			
				
					|  |  |  |     print(env.printGrid(init=True)) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     LOG("> Starting MiniGrid2PRISM ...") | 
			
		
	
		
			
				
					|  |  |  |     with open("grid", "w") as infile: | 
			
		
	
		
			
				
					|  |  |  |         infile.write(env.printGrid(init=True)) | 
			
		
	
		
			
				
					|  |  |  |     system("./Minigrid2PRISM/build/main -i grid -o testing.prism -v 'agent'") | 
			
		
	
		
			
				
					|  |  |  |     LOG("> Finished Application!") | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | # ........................................................................... # | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | if __name__ == '__main__': | 
			
		
	
		
			
				
					|  |  |  |     main() |