【问题标题】:OpenAI Gym Manual Play function automatically presses keyOpenAI Gym Manual Play功能自动按键
【发布时间】:2022-12-04 00:02:59
【问题描述】:
import gym
from gym.utils import play
play.play(gym.make('MountainCar-v0', render_mode='rgb_array').env, zoom=1,  keys_to_action={"0":0, "2":2, "1":1})

以上代码是手动播放 MountainCar 所需的全部代码。

控件如下:

0 = 无

1 = 左

2 = 正确

然而,当我运行代码时,如果我没有按任何东西,汽车会自动向左行驶,就像按下键盘上的“1”键一样。

我试过在文档中搜索解决方案,但没有成功。 https://github.com/openai/gym/blob/master/gym/utils/play.py

【问题讨论】:

    标签: python openai-gym


    【解决方案1】:
    import gym
    from gym.utils import play
    env = play.play(gym.make('MountainCar-v0', render_mode='rgb_array').env, zoom=1,  keys_to_action={"2":2, "1":0}, noop=1)
    

    noop 设置默认操作

    【讨论】:

      猜你喜欢
      • 2022-10-08
      • 1970-01-01
      • 1970-01-01
      • 2022-08-24
      • 1970-01-01
      • 2017-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多