Implemented CLI to select env for testing
This commit is contained in:
parent
7113190e35
commit
4cd64a6fbd
@ -1,5 +1,5 @@
|
|||||||
from time import sleep, time
|
from time import sleep, time
|
||||||
from env import *
|
import env
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pygame
|
import pygame
|
||||||
|
|
||||||
@ -7,13 +7,37 @@ from observables import Observable, CnnObservable
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
#env = ColumbusTest3_1(fps=30)
|
Env = chooseEnv()
|
||||||
env = ColumbusStateWithBarriers(fps=30)
|
env = Env(fps=30)
|
||||||
env.start_pos = [0.6, 0.3]
|
env.start_pos = [0.6, 0.3]
|
||||||
playEnv(env)
|
playEnv(env)
|
||||||
env.close()
|
env.close()
|
||||||
|
|
||||||
|
|
||||||
|
def getAvaibleEnvs():
|
||||||
|
# kinda hacky... idk
|
||||||
|
strs = dir(env)
|
||||||
|
for s in strs:
|
||||||
|
if s.startswith('Columbus') and s != 'ColumbusEnv':
|
||||||
|
yield getattr(env, s)
|
||||||
|
|
||||||
|
|
||||||
|
def chooseEnv():
|
||||||
|
envs = list(getAvaibleEnvs())
|
||||||
|
for i, Env in enumerate(envs):
|
||||||
|
print('['+str(i)+'] '+Env.__name__)
|
||||||
|
while True:
|
||||||
|
inp = input('[#> ')
|
||||||
|
try:
|
||||||
|
i = int(inp)
|
||||||
|
except:
|
||||||
|
print('[!] You have to enter the number...')
|
||||||
|
if i < 0 or i >= len(envs):
|
||||||
|
print(
|
||||||
|
'[!] That is a number, but not one that makes sense in this context...')
|
||||||
|
return envs[i]
|
||||||
|
|
||||||
|
|
||||||
def playEnv(env):
|
def playEnv(env):
|
||||||
env.reset()
|
env.reset()
|
||||||
done = False
|
done = False
|
||||||
|
Loading…
Reference in New Issue
Block a user