Get FPS from env

This commit is contained in:
Dominik Moritz Roth 2022-06-22 13:12:55 +02:00
parent 0e17b4c07e
commit 941b7347f1

View File

@ -23,7 +23,7 @@ def main(env_name='ColumbusStateWithBarriers-v0'):
env, env,
verbose=0, verbose=0,
tensorboard_log=root_path+"/logs_tb/"+env_name+"/ppo_latent_sde/", tensorboard_log=root_path+"/logs_tb/"+env_name+"/ppo_latent_sde/",
#use_sde=True, use_sde=True,
sde_sample_freq=30*15, sde_sample_freq=30*15,
#ent_coef=0.0016/1.25, #0.0032 #ent_coef=0.0016/1.25, #0.0032
#vf_coef=0.00025/2, #0.0005 #vf_coef=0.00025/2, #0.0005
@ -49,7 +49,7 @@ def main(env_name='ColumbusStateWithBarriers-v0'):
#) #)
print('PPO_LATENT_SDE:') print('PPO_LATENT_SDE:')
testModel(ppo_latent_sde, 25000, showRes = True, saveModel=True, n_eval_episodes=3) testModel(ppo_latent_sde, 500000, showRes = True, saveModel=True, n_eval_episodes=3)
#print('SAC_LATENT_SDE:') #print('SAC_LATENT_SDE:')
#testModel(sac_latent_sde, 250000, showRes = True, saveModel=True, n_eval_episodes=0) #testModel(sac_latent_sde, 250000, showRes = True, saveModel=True, n_eval_episodes=0)
#print('TRL_PG:') #print('TRL_PG:')
@ -74,8 +74,8 @@ def testModel(model, timesteps=150000, showRes=False, saveModel=False, n_eval_ep
obs = env.reset() obs = env.reset()
# Evaluate the agent # Evaluate the agent
episode_reward = 0 episode_reward = 0
for _ in range(30*60*5): while True:
time.sleep(1/30) time.sleep(1/env.fps)
action, _ = model.predict(obs, deterministic=False) action, _ = model.predict(obs, deterministic=False)
obs, reward, done, info = env.step(action) obs, reward, done, info = env.step(action)
env.render() env.render()