mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-04 14:43:08 +02:00
feat: made metadrive use gym insstead of gymnasium
This commit is contained in:
parent
b93c2bc693
commit
954ef7dbf2
@ -1,10 +1,11 @@
|
||||
from metadrive.envs.metadrive_env import MetaDriveEnv
|
||||
import gymnasium as gym
|
||||
from metadrive.envs.gym_wrapper import createGymWrapper # import the wrapper
|
||||
|
||||
env = MetaDriveEnv(config={"use_render": True})
|
||||
obs, info = env.reset()
|
||||
env = createGymWrapper(MetaDriveEnv)(config={"use_render": True}) # wrap the environment
|
||||
obs = env.reset()
|
||||
for i in range(1000):
|
||||
obs, reward, terminated, truncated, info = env.step(env.action_space.sample())
|
||||
if terminated or truncated:
|
||||
obs, reward, done, info = env.step(env.action_space.sample()) # the return value contains no truncate
|
||||
if done:
|
||||
env.reset()
|
||||
env.close()
|
||||
@ -1,2 +1,3 @@
|
||||
metadrive-simulator
|
||||
gymnasium
|
||||
gymnasium
|
||||
gym
|
||||
Loading…
Reference in New Issue
Block a user