example.py 1.1 KB
Newer Older
1
import sys
Galo Maldonado's avatar
Galo Maldonado committed
2
3
4
5
6
sys.path.append('ospi')

import subprocess
import time
#from ospi 
7
8
9
10
11
12
13
14
15
16
17
import viewer_utils as vw
import wrapper as wr
import motion_parser as mtp

# The path to the model meshes
mesh_path='/local/gmaldona/devel/Models/data/whole_body/obj'
# The path to the model and the filename
filename='/local/gmaldona/devel/Models/data/whole_body/wholebody.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_model1')
Galo Maldonado's avatar
Galo Maldonado committed
18
19
20
21
22
23
24


# call the gepetto viewer server
gvs = subprocess.Popen(["./gepetto-viewer.sh","&"])
print 'Loading the viewer ...'
time.sleep(2)

25
26
27
28
29
30
31
# Init the viewer and add the model to it 
viewer = vw.Viewer('viewer',wb_model)
viewer.setVisibility(wb_model.name+"/floor", "OFF")
viewer.display(wb_model.q0, wb_model.name)

# See kinematic ranges of motion

Galo Maldonado's avatar
Galo Maldonado committed
32
33
34
35
36
# See markers

# See axis
viewer.JointFrames(wb_model.name)

37
38
39
# parse motion:
time, q, colheaders, qOsim = mtp.parseMotion(wb_model.model, wb_model.joint_transformations, '/home/gmaldona/Dropbox/kv03_filtered_ik.mot','quat')