train_pybullet_racecar.py works, self-driving car drives towards the ball using OpenAI baselines DQN :-)

See https://www.youtube.com/watch?v=DZ5Px-ocelw for video and how-to-install.
This commit is contained in:
erwincoumans
2017-06-10 18:46:36 -07:00
parent 4a7469a1ba
commit 1752aa55ca
5 changed files with 50 additions and 46 deletions

View File

@@ -6,7 +6,7 @@ from baselines import deepq
def main():
env = RacecarGymEnv(render=True)
env = RacecarGymEnv(renders=True)
act = deepq.load("racecar_model.pkl")
print(act)
while True:
@@ -16,27 +16,8 @@ def main():
print(obs)
episode_rew = 0
while not done:
#env.render()
print("!!!!!!!!!!!!!!!!!!!!!!!!!!")
print("obs")
print(obs)
print("???????????????????????????")
print("obs[None]")
print(obs[None])
o = obs[None]
print("o")
print(o)
aa = act(o)
print("aa")
print (aa)
a = aa[0]
print("a")
print(a)
obs, rew, done, _ = env.step(a)
print("===================================")
print("obs")
print(obs)
env.render()
obs, rew, done, _ = env.step(act(obs[None])[0])
episode_rew += rew
print("Episode reward", episode_rew)