Skip to content

Commit

Permalink
Merge pull request #41 from OliEfr/example_to_replay_actions
Browse files Browse the repository at this point in the history
add example for replaying actions in gymnasium
  • Loading branch information
robfiras authored Sep 9, 2024
2 parents e21b63e + a93c995 commit 6626776
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import gymnasium as gym
import numpy as np
from loco_mujoco import LocoEnv


def experiment():

env = gym.make(
"LocoMujoco",
env_name="UnitreeA1.simple.perfect",
render_mode="human",
random_start=False,
init_step_no=0,
)

expert_dataset = env.create_dataset()
expert_actions = expert_dataset["actions"]

env.reset()
env.render()

i = 0
while i < 1000:
action = expert_actions[i, :]
nstate, reward, terminated, truncated, info = env.step(action)

env.render()
i += 1


if __name__ == "__main__":
experiment()

0 comments on commit 6626776

Please sign in to comment.