JHU Wrapper Example#

This examples shows how to configure and run a JHU environmenting using the wrapper. The JHU environments require prt-sim to be installed to work properly.

[8]:
from prt_sim.jhu.gold_explorer import GoldExplorer
from prt_rl.env.wrappers import JhuWrapper
from prt_rl.common.policy.random_policy import RandomPolicy
from prt_rl.common.runners import Runner
from prt_rl.common.recorders import GifRecorder

Setup Environment#

Initialize the wrapper with a JHU environment.

[9]:
env = JhuWrapper(
    environment=GoldExplorer(),
    render_mode="rgb_array"
)

Initialize Random Policy#

Create a random policy that takes in the environment parameters

[10]:
policy = RandomPolicy(env_params=env.get_parameters())

Create a Runner#

Run the environment for a single episode until it is done and record a gif.

[11]:
runner = Runner(
    env=env,
    policy=policy,
    recorder=GifRecorder(
        filename='jhu_wrapper.gif'
    )
)
[12]:
runner.run()
GoldExplorer