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.

37 lines
1.3 KiB

  1. import gym
  2. from gym_minigrid.wrappers import RGBImgObsWrapper, ImgObsWrapper, MiniWrapper
  3. from subprocess import call
  4. from os import listdir, system
  5. from os.path import isfile, join, getctime
  6. import argparse
  7. from gym_minigrid.policyRepairEnv import State
  8. def main():
  9. LOG("> Start Application ...")
  10. #################################################################
  11. # Parse command line arguments
  12. parser = argparse.ArgumentParser()
  13. parser.add_argument('--env', type=str, required=True, help='Environment (for now only "Testing-v0" possible)')
  14. args = parser.parse_args()
  15. ################################################################
  16. # Create & Setup environment
  17. env = gym.make(args.env, render_mode="human")
  18. env = RGBImgObsWrapper(env) # Get pixel observations
  19. env = ImgObsWrapper(env) # Get rid of the 'mission' field
  20. env = MiniWrapper(env) # Project specific changes
  21. observation = env.reset()
  22. print(env.printGrid(init=True))
  23. LOG("> Starting MiniGrid2PRISM ...")
  24. with open("grid", "w") as infile:
  25. infile.write(env.printGrid(init=True))
  26. system("./Minigrid2PRISM/build/main -i grid -o testing.prism -v 'agent'")
  27. LOG("> Finished Application!")
  28. # ........................................................................... #
  29. if __name__ == '__main__':
  30. main()