a | b/tests/test.rollback.py | ||
---|---|---|---|
1 | from osim.env import L2RunEnv |
||
2 | import opensim |
||
3 | |||
4 | env = L2RunEnv(visualize=True) |
||
5 | observation = env.reset() |
||
6 | |||
7 | s = 0 |
||
8 | for s in range(80): |
||
9 | d = False |
||
10 | |||
11 | if s == 30: |
||
12 | state_old = env.osim_model.get_state() |
||
13 | print("State stored") |
||
14 | print(state_old) |
||
15 | if s % 50 == 49: |
||
16 | env.osim_model.set_state(state_old) |
||
17 | print("Rollback") |
||
18 | print(state_old) |
||
19 | |||
20 | o, r, d, i = env.step(env.action_space.sample()) |