madras-simulator / MADRaS

Multi-Agent DRiving Simulator
GNU Affero General Public License v3.0
90 stars 20 forks source link

Added Seeding and changed timeout time #15

Closed rudrasohan closed 5 years ago

rudrasohan commented 5 years ago

Why? Many algorithms use a seed before starting an experiment. And the lack of that feature causes to throw an error.

What? Added seeding functionality for Madras env.

Testing:

import gym
import MADRaS
env_name = 'Madras-v0'
env = gym.make(env_name)
a = env.seed(445)
print(a)
env.reset()
for i in range(1000):
    print("STER: {}".format(i))
    env.step(env.action_space.sample()) # take a random action
print('#################OVER####################')
env.reset()
for i in range(1000):
    print("STER: {}".format(i))
    ob, r, done, info  = env.step(env.action_space.sample()) # take a random 
env.close()

NOTE: As of now the seed is not used by torcs before starting a race but we can incorporate it later, in maybe starting race at random positions.