Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discrepancy between the planned duration and the actual testing time #622

Open
Feiju112 opened this issue Sep 21, 2024 · 0 comments
Open

Comments

@Feiju112
Copy link

In the highway_env environment, I have designed the following:
def default_config(cls) -> dict:
cfg = super().default_config()
cfg.update({
"simulation_frequency": 5,
"policy_frequency": 5,
"lanes_count": 3,
"vehicles_count": 30,
"duration": 30, # [s]
"ego_spacing": 1.5,
})
return cfg
Here, the duration is set to 30 seconds. However, when validating the trained PPO policy, the recorded result consistently lasts only 15 seconds, despite no collisions that would terminate the simulation. The following is the testing and rendering code:

Run the trained model and record video

env = gymnasium.make("highway-fast-v0", render_mode="rgb_array")
env = RecordVideo(env, video_folder="./ppo_videos", episode_trigger=lambda e: True)
env.unwrapped.set_record_video_wrapper(env)
env.configure({"simulation_frequency": 15}) # Higher FPS for rendering
model = PPO.load("highway_ppo/model", env=env)
for videos in range(20):
done = truncated = False
obs, info = env.reset()
while not (done or truncated):
action, _states = model.predict(obs, deterministic=True)
obs, reward, done, truncated, info = env.step(action)
env.render()
env.close()
Please provide the specific issue. Thank you!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant