[535f03]: / tests / test.simbody.py

Download this file

28 lines (20 with data), 691 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from osim.env import ProstheticsEnv
import numpy as np
import unittest
class SimulationTest(unittest.TestCase):
def test1(self):
env = ProstheticsEnv(visualize=True)
observation = env.reset()
simbody_state = env.osim_model.get_state()
print(simbody_state.getNumSubsystems())
print(simbody_state.getY())
oldy = simbody_state.updY()
for i in range(len(oldy)):
oldy[i] += 0.2
print(simbody_state.getY())
env.osim_model.set_state(simbody_state)
action = env.action_space.sample()
for i in range(50):
env.step(action)
if __name__ == '__main__':
unittest.main()