Browse Source

added install script and simple runner

main
sp 1 year ago
parent
commit
667acb8895
  1. 14
      install.sh
  2. 37
      run_simple.py

14
install.sh

@ -0,0 +1,14 @@
#!/bin/bash
# aptitude dependencies
sudo apt install python3.8-venv python3-tk
python3 -m pip install --user virtualenv
python3 -m venv env
source env/bin/activate
which python3
cd gym_minigrid/
python3 -m pip install -e .
cd ..

37
run_simple.py

@ -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()
Loading…
Cancel
Save