You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

45 lines
1.5 KiB

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
LOG_MODE = True
# ........................................................................... #
def LOG(text : str) -> None:
if (LOG_MODE):
print(text)
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()