-
Notifications
You must be signed in to change notification settings - Fork 5
/
render_module.py
executable file
·161 lines (149 loc) · 4.5 KB
/
render_module.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import numpy as np
viewer = None
camera = None
gl_render = None
bullet_render = None
gl = None
glu = None
glut = None
flag = {}
flag['all_scene'] = True
flag['follow_cam'] = [0, ("fixed", "pos", "pos+rot")]
flag['ground'] = True
flag['origin'] = False
flag['shadow'] = True
flag['sim_model'] = True
flag['kin_model'] = False
flag['joint'] = False
flag['com_vel'] = False
flag['collision'] = False
flag['overlay'] = True
flag['overlay_text'] = False
flag['target_pose'] = False
flag['auto_play'] = False
flag['fog'] = False
flag['facing_frame'] = False
flag['interaction'] = True
flag['obstacle'] = True
flag['root_trajectory'] = False
flag['custom1'] = False
flag['custom2'] = False
flag['custom3'] = False
flag['custom4'] = False
flag['custom5'] = False
flag['custom6'] = False
flag['custom7'] = False
flag['toggle_interaction']=False
flag['toggle_agent'] = False
toggle = {}
toggle[b'`'] = 'all_scene'
toggle[b'0'] = 'follow_cam'
toggle[b'1'] = 'ground'
toggle[b'2'] = 'origin'
toggle[b'3'] = 'shadow'
toggle[b'4'] = 'sim_model'
toggle[b'5'] = 'kin_model'
toggle[b'6'] = 'joint'
toggle[b'7'] = 'com_vel'
toggle[b'8'] = 'collision'
toggle[b'9'] = 'overlay'
toggle[b'T'] = 'overlay_text'
toggle[b't'] = 'target_pose'
toggle[b'a'] = 'auto_play'
toggle[b'f'] = 'fog'
toggle[b'F'] = 'facing_frame'
toggle[b'i'] = 'interaction'
toggle[b'o'] = 'obstacle'
toggle[b'y'] = 'root_trajectory'
toggle[b'!'] = 'custom1'
toggle[b'@'] = 'custom2'
toggle[b'#'] = 'custom3'
toggle[b'$'] = 'custom4'
toggle[b'%'] = 'custom5'
toggle[b'^'] = 'custom6'
toggle[b'&'] = 'custom7'
toggle[b'~'] = 'toggle_interaction'
toggle[b'/'] = 'toggle_agent'
def get_flag(keyword):
entity = flag[keyword]
if isinstance(flag[keyword], list):
return entity[1][entity[0]]
elif isinstance(entity, bool):
return entity
else:
raise NotImplementedError
tex_id_ground = None
# file_tex_ground = "data/image/grid2.png"
COLORS_FOR_AGENTS = [
np.array([30, 120, 180, 255])/255,
np.array([215, 40, 40, 255])/255,
np.array([150, 100, 190, 255])/255,
np.array([225, 120, 190, 255])/255,
np.array([140, 90, 80, 255])/255,
np.array([50, 160, 50, 255])/255,
np.array([255, 125, 15, 255])/255,
np.array([125, 125, 125, 255])/255,
np.array([255, 0, 255, 255])/255,
np.array([0, 255, 125, 255])/255,
np.array([50, 50, 50, 255])/255,
np.array([175, 175, 175, 255])/255,
np.array([248, 215, 3, 255])/255,
np.array([248, 60, 18, 255])/255,
np.array([243, 118, 97, 255])/255,
np.array([247, 116, 25, 255])/255,
np.array([249, 241, 215, 255])/255,
]
COLOR_AGENT = np.array([85, 160, 173, 255])/255.0
COLORS_FOR_EXPERTS = [
np.array([30, 120, 180, 255])/255,
np.array([215, 40, 40, 255])/255,
np.array([150, 100, 190, 255])/255,
np.array([225, 120, 190, 255])/255,
np.array([140, 90, 80, 255])/255,
np.array([50, 160, 50, 255])/255,
np.array([255, 125, 15, 255])/255,
np.array([125, 125, 125, 255])/255,
np.array([255, 0, 255, 255])/255,
np.array([0, 255, 125, 255])/255,
np.array([50, 50, 50, 255])/255,
np.array([175, 175, 175, 255])/255,
np.array([248, 215, 3, 255])/255,
np.array([248, 60, 18, 255])/255,
np.array([243, 118, 97, 255])/255,
np.array([247, 116, 25, 255])/255,
np.array([249, 241, 215, 255])/255,
]
# COLORS_FOR_AGENTS = [
# np.array([30, 120, 180, 255])/255,
# np.array([30, 120, 180, 255])/255,
# np.array([30, 120, 180, 255])/255,
# np.array([30, 120, 180, 255])/255,
# np.array([215, 40, 40, 255])/255,
# np.array([215, 40, 40, 255])/255,
# np.array([215, 40, 40, 255])/255,
# np.array([215, 40, 40, 255])/255,
# np.array([50, 160, 50, 255])/255,
# np.array([50, 160, 50, 255])/255,
# np.array([50, 160, 50, 255])/255,
# np.array([50, 160, 50, 255])/255,
# np.array([248, 215, 3, 255])/255,
# np.array([248, 215, 3, 255])/255,
# np.array([248, 215, 3, 255])/255,
# np.array([248, 215, 3, 255])/255,
# ]
LINK_INFO_SCALE = 1.025
LINK_INFO_LINE_WIDTH = 1.0
LINK_INFO_NUM_SLICE = 32
initialized = False
def initialize():
global initialized
if initialized: return
global viewer, gl_render, camera, bullet_render, gl, glu, glut
from fairmotion.viz import glut_viewer as viewer
from fairmotion.viz import camera
from fairmotion.viz import gl_render
from bullet import bullet_render
import OpenGL.GL as gl
import OpenGL.GLU as glu
import OpenGL.GLUT as glut
initialized = True