-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathexampleOLI.py
More file actions
executable file
·47 lines (34 loc) · 1.21 KB
/
exampleOLI.py
File metadata and controls
executable file
·47 lines (34 loc) · 1.21 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
import subprocess
import time
import ospi.motion_parser as mtp
import ospi.viewer_utils as vw
import ospi.wrapper as wr
# The path to the model meshes
mesh_path = 'models/whole_body/obj'
# The path to the model and the filename
filename = 'models/whole_body/wholebodyOLI.osim'
# Create a wrapper specific to the whole-body model
# The wrapper parse the OpenSim model and builds pinocchio model and data
wb_model = wr.Wrapper(filename, mesh_path, name='whole-body_model10')
# call the gepetto viewer server
gvs = subprocess.Popen('gepetto-gui')
print('Loading the viewer ...')
time.sleep(2)
# Init the viewer and add the model to it
viewer = vw.Viewer('viewer', wb_model)
viewer.setVisibility(wb_model.name + "/floor", "ON")
viewer.display(wb_model.q0, wb_model.name)
# See axis
# viewer.JointFrames(wb_model.name)
# parse motion:
time, q, colheaders, qOsim = mtp.parseMotion(wb_model.model, wb_model.joint_transformations, 'OLI_F_3.mot', 'quat')
t = 0.0
def playMotions(first=0, last=1, step=3, t=0):
for i in range(first, last, step):
viewer.setVisibility("OLI", "ON")
viewer.display(q[i].T, wb_model.name)
# time.sleep(4)
playMotions(0, 396, 1, 0.0025)
time.sleep(4)
gvs.terminate()